Class: Base4R::FloatUnitAttribute

Inherits:
SomethingUnits show all
Defined in:
lib/attribute.rb

Overview

FloatUnitAttribute represents a floating-point property with units.

Instance Attribute Summary

Attributes inherited from SomethingUnits

#units, #value_without_units

Attributes inherited from Attribute

#name, #namespace, #options, #private_attribute, #value

Instance Method Summary collapse

Methods inherited from SomethingUnits

#value, #value=

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) ⇒ FloatUnitAttribute

Create a FloatUnitAttribute with name, a quantity of number, described in units and in namespace old definition:

FloatUnitAttribute.new(name, number, units, namespace)

new definition:

FloatUnitAttribute.new(name, number, options={})
FloatUnitAttribute.new(:price, 50, :units => :USD, :namespace => :g)

Additional Options

:units - the units used



302
303
304
305
306
307
308
# File 'lib/attribute.rb', line 302

def initialize(*args)
  if args.length == 4 and !args.last.is_a?(Hash)
    super(:name => args[0], :value => args[1], :units => args[2], :namespace => args.last)
  else
    super *args
  end
end