Class: Shipit::VariableDefinition
- Inherits:
-
Object
- Object
- Shipit::VariableDefinition
- Defined in:
- app/models/shipit/variable_definition.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#select ⇒ Object
readonly
Returns the value of attribute select.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #default_provided? ⇒ Boolean
-
#initialize(attributes) ⇒ VariableDefinition
constructor
A new instance of VariableDefinition.
- #to_h ⇒ Object
Constructor Details
#initialize(attributes) ⇒ VariableDefinition
Returns a new instance of VariableDefinition.
7 8 9 10 11 12 13 |
# File 'app/models/shipit/variable_definition.rb', line 7 def initialize(attributes) @name = attributes.fetch('name') @title = attributes['title'] @default = attributes['default'].to_s @default_provided = attributes.key?('default') @select = attributes['select'].presence end |
Instance Attribute Details
#default ⇒ Object (readonly)
Returns the value of attribute default.
5 6 7 |
# File 'app/models/shipit/variable_definition.rb', line 5 def default @default end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'app/models/shipit/variable_definition.rb', line 5 def name @name end |
#select ⇒ Object (readonly)
Returns the value of attribute select.
5 6 7 |
# File 'app/models/shipit/variable_definition.rb', line 5 def select @select end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'app/models/shipit/variable_definition.rb', line 5 def title @title end |
Instance Method Details
#default_provided? ⇒ Boolean
15 16 17 |
# File 'app/models/shipit/variable_definition.rb', line 15 def default_provided? @default_provided end |
#to_h ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'app/models/shipit/variable_definition.rb', line 19 def to_h { 'name' => @name, 'title' => @title, 'default' => @default, 'select' => @select } end |