Class: Base4R::SomethingUnits
Direct Known Subclasses
Instance Attribute Summary collapse
-
#units ⇒ Object
Returns the value of attribute units.
-
#value_without_units ⇒ Object
Returns the value of attribute value_without_units.
Attributes inherited from Attribute
#name, #namespace, #options, #private_attribute
Instance Method Summary collapse
-
#initialize(*args) ⇒ SomethingUnits
constructor
A new instance of SomethingUnits.
- #value ⇒ Object
- #value=(v) ⇒ Object
Methods inherited from Attribute
#private_attribute?, #to_xml, to_xml, #type_name, type_name, #type_name=
Methods included from AdditionalXmlAttributeMethods
#additional_xml_attribute_map, included, #xml_attribute_value, #xml_attributes
Methods included from ChildAttributeMethods
#add_child, #add_child_attribute, #child, #children, #children_map, #children_names, included
Constructor Details
#initialize(*args) ⇒ SomethingUnits
Returns a new instance of SomethingUnits.
280 281 282 283 284 |
# File 'lib/attribute.rb', line 280 def initialize(*args) super(*args) @units = .delete(:units) @value_without_units = @value end |
Instance Attribute Details
#units ⇒ Object
Returns the value of attribute units.
277 278 279 |
# File 'lib/attribute.rb', line 277 def units @units end |
#value_without_units ⇒ Object
Returns the value of attribute value_without_units.
278 279 280 |
# File 'lib/attribute.rb', line 278 def value_without_units @value_without_units end |
Instance Method Details
#value ⇒ Object
286 |
# File 'lib/attribute.rb', line 286 def value; "#{@value_without_units} #{@units}".strip; end |
#value=(v) ⇒ Object
287 |
# File 'lib/attribute.rb', line 287 def value=(v); @value_without_units, @units = v.split; end |