Class: CfScript::Attribute
- Inherits:
-
Object
- Object
- CfScript::Attribute
- Defined in:
- lib/cf_script/object/attribute.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(name, value) ⇒ Attribute
constructor
A new instance of Attribute.
- #to_a ⇒ Object
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(name, value) ⇒ Attribute
Returns a new instance of Attribute.
4 5 6 7 |
# File 'lib/cf_script/object/attribute.rb', line 4 def initialize(name, value) @name = name @value = value end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/cf_script/object/attribute.rb', line 2 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
2 3 4 |
# File 'lib/cf_script/object/attribute.rb', line 2 def value @value end |
Instance Method Details
#to_a ⇒ Object
9 10 11 |
# File 'lib/cf_script/object/attribute.rb', line 9 def to_a value ? value.split(/,\s*/) : [] end |
#to_s ⇒ Object Also known as: inspect
13 14 15 |
# File 'lib/cf_script/object/attribute.rb', line 13 def to_s "#{name}: #{value}" end |