Class: Smplkit::Config::ConfigItem
- Inherits:
-
Object
- Object
- Smplkit::Config::ConfigItem
- Defined in:
- lib/smplkit/config/models.rb
Overview
A single typed item in a Config.
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#name ⇒ Object
Returns the value of attribute name.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(name:, value:, type:, description: nil) ⇒ ConfigItem
constructor
A new instance of ConfigItem.
- #to_h ⇒ Object
Constructor Details
#initialize(name:, value:, type:, description: nil) ⇒ ConfigItem
Returns a new instance of ConfigItem.
19 20 21 22 23 24 |
# File 'lib/smplkit/config/models.rb', line 19 def initialize(name:, value:, type:, description: nil) @name = name @value = value @type = type @description = description end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
17 18 19 |
# File 'lib/smplkit/config/models.rb', line 17 def description @description end |
#name ⇒ Object
Returns the value of attribute name.
17 18 19 |
# File 'lib/smplkit/config/models.rb', line 17 def name @name end |
#type ⇒ Object
Returns the value of attribute type.
17 18 19 |
# File 'lib/smplkit/config/models.rb', line 17 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
17 18 19 |
# File 'lib/smplkit/config/models.rb', line 17 def value @value end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
30 31 32 33 |
# File 'lib/smplkit/config/models.rb', line 30 def ==(other) other.is_a?(ConfigItem) && other.name == @name && other.value == @value && other.type == @type && other.description == @description end |
#hash ⇒ Object
36 |
# File 'lib/smplkit/config/models.rb', line 36 def hash = [@name, @value, @type, @description].hash |
#to_h ⇒ Object
26 27 28 |
# File 'lib/smplkit/config/models.rb', line 26 def to_h { "name" => @name, "value" => @value, "type" => @type, "description" => @description }.compact end |