Class: Elibri::ONIX::Release_3_0::Measure
- Inherits:
-
Object
- Object
- Elibri::ONIX::Release_3_0::Measure
- Defined in:
- lib/elibri_onix/onix_3_0/measure.rb
Instance Attribute Summary collapse
-
#measurement ⇒ Object
Returns the value of attribute measurement.
-
#to_xml ⇒ Object
Returns the value of attribute to_xml.
-
#type ⇒ Object
Returns the value of attribute type.
-
#unit ⇒ Object
Returns the value of attribute unit.
Instance Method Summary collapse
-
#initialize(data) ⇒ Measure
constructor
A new instance of Measure.
- #inspect_include_fields ⇒ Object
- #type_name ⇒ Object
Constructor Details
#initialize(data) ⇒ Measure
Returns a new instance of Measure.
8 9 10 11 12 13 14 |
# File 'lib/elibri_onix/onix_3_0/measure.rb', line 8 def initialize(data) @to_xml = data.to_s @type = data.at_css('MeasureType')&.text @measurement = data.at_css('Measurement')&.text&.to_i @unit = data.at_css('MeasureUnitCode')&.text end |
Instance Attribute Details
#measurement ⇒ Object
Returns the value of attribute measurement.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/measure.rb', line 6 def measurement @measurement end |
#to_xml ⇒ Object
Returns the value of attribute to_xml.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/measure.rb', line 6 def to_xml @to_xml end |
#type ⇒ Object
Returns the value of attribute type.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/measure.rb', line 6 def type @type end |
#unit ⇒ Object
Returns the value of attribute unit.
6 7 8 |
# File 'lib/elibri_onix/onix_3_0/measure.rb', line 6 def unit @unit end |
Instance Method Details
#inspect_include_fields ⇒ Object
20 21 22 |
# File 'lib/elibri_onix/onix_3_0/measure.rb', line 20 def inspect_include_fields [:type_name] end |
#type_name ⇒ Object
16 17 18 |
# File 'lib/elibri_onix/onix_3_0/measure.rb', line 16 def type_name Elibri::ONIX::Dict::Release_3_0::MeasureType.find_by_onix_code(@type)&.const_name&.downcase end |