Class: Elibri::ONIX::Release_3_0::Measure
- Inherits:
-
Object
- Object
- Elibri::ONIX::Release_3_0::Measure
- Includes:
- HashId
- Defined in:
- lib/elibri_onix/onix_3_0/measure.rb
Overview
klasa abstahuje parsowanie wymiarów książki.
Constant Summary collapse
- ATTRIBUTES =
[ :type, :measurement, :unit, :type_name ]
- RELATIONS =
[ :inspect_include_fields ]
Constants included from HashId
HashId::SKIPPED_2, HashId::SKIPPED_ATTRIBS
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
Methods included from HashId
Constructor Details
#initialize(data) ⇒ Measure
Returns a new instance of Measure.
21 22 23 24 25 26 27 |
# File 'lib/elibri_onix/onix_3_0/measure.rb', line 21 def initialize(data) @to_xml = data.to_s @type = data.at_css('MeasureType').try(:text) @measurement = data.at_css('Measurement').try(:text).try(:to_i) @unit = data.at_css('MeasureUnitCode').try(:text) end |
Instance Attribute Details
#measurement ⇒ Object
Returns the value of attribute measurement.
19 20 21 |
# File 'lib/elibri_onix/onix_3_0/measure.rb', line 19 def measurement @measurement end |
#to_xml ⇒ Object
Returns the value of attribute to_xml.
19 20 21 |
# File 'lib/elibri_onix/onix_3_0/measure.rb', line 19 def to_xml @to_xml end |
#type ⇒ Object
Returns the value of attribute type.
19 20 21 |
# File 'lib/elibri_onix/onix_3_0/measure.rb', line 19 def type @type end |
#unit ⇒ Object
Returns the value of attribute unit.
19 20 21 |
# File 'lib/elibri_onix/onix_3_0/measure.rb', line 19 def unit @unit end |
Instance Method Details
#inspect_include_fields ⇒ Object
33 34 35 |
# File 'lib/elibri_onix/onix_3_0/measure.rb', line 33 def inspect_include_fields [:type_name] end |