Class: Elibri::ONIX::Release_3_0::Extent
- Inherits:
-
Object
- Object
- Elibri::ONIX::Release_3_0::Extent
- Defined in:
- lib/elibri_onix/onix_3_0/extent.rb
Constant Summary collapse
- ATTRIBUTES =
from ONIX documentation: covers product extents, in terms of pages, running times, file sizes etc, as may be appropriate to each media type. For products whose content is primarily readable text, it also covers illustrations and other kinds of ancillary matter such as the inclusion of a bibliography or index.
[ :type, :value, :unit, :type_name, :unit_name ]
- RELATIONS =
[ :inspect_include_fields ]
Instance Attribute Summary collapse
-
#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.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #eid ⇒ Object
- #id ⇒ Object
-
#initialize(data) ⇒ Extent
constructor
A new instance of Extent.
- #inspect_include_fields ⇒ Object
- #type_name ⇒ Object
- #unit_name ⇒ Object
Constructor Details
#initialize(data) ⇒ Extent
Returns a new instance of Extent.
23 24 25 26 27 28 |
# File 'lib/elibri_onix/onix_3_0/extent.rb', line 23 def initialize(data) @to_xml = data.to_s @type = data.xpath('xmlns:ExtentType').try(:text) @value = data.xpath('xmlns:ExtentValue').try(:text).try(:to_i) @unit = data.xpath('xmlns:ExtentUnit').try(:text) end |
Instance Attribute Details
#to_xml ⇒ Object
Returns the value of attribute to_xml.
21 22 23 |
# File 'lib/elibri_onix/onix_3_0/extent.rb', line 21 def to_xml @to_xml end |
#type ⇒ Object
Returns the value of attribute type.
21 22 23 |
# File 'lib/elibri_onix/onix_3_0/extent.rb', line 21 def type @type end |
#unit ⇒ Object
Returns the value of attribute unit.
21 22 23 |
# File 'lib/elibri_onix/onix_3_0/extent.rb', line 21 def unit @unit end |
#value ⇒ Object
Returns the value of attribute value.
21 22 23 |
# File 'lib/elibri_onix/onix_3_0/extent.rb', line 21 def value @value end |
Instance Method Details
#eid ⇒ Object
30 31 32 |
# File 'lib/elibri_onix/onix_3_0/extent.rb', line 30 def eid @type.to_i end |
#id ⇒ Object
34 35 36 37 |
# File 'lib/elibri_onix/onix_3_0/extent.rb', line 34 def id Kernel.warn "[DEPRECATION] `id` is deprecated. Please use `eid` instead." eid end |
#inspect_include_fields ⇒ Object
47 48 49 |
# File 'lib/elibri_onix/onix_3_0/extent.rb', line 47 def inspect_include_fields [:type_name, :unit_name] end |