Class: ONIX::Extent
Instance Attribute Summary
Attributes included from Attributes
High level collapse
-
#bytes ⇒ Integer
bytes count.
-
#pages ⇒ Integer
pages count.
Low level collapse
- #extent_type ⇒ ExtentType
- #extent_unit ⇒ ExtentUnit
- #extent_value ⇒ String
- #extent_value_roman ⇒ String
Shortcuts collapse
-
#type ⇒ ExtentType
shortcut for #extent_type.
-
#unit ⇒ ExtentUnit
shortcut for #extent_unit.
-
#value ⇒ String
shortcut for #extent_value.
Methods inherited from SubsetDSL
element, elements, #get_class, get_class, inherited, #initialize, n, #parse, ref_to_short, register_elements, register_scopes, #register_subset_array, registered_elements, #registered_elements, registered_scopes, scope, short_to_ref
Methods inherited from Subset
parse, #parse, #tag_match, #unsupported
Methods included from Attributes
attribute_class, #parse_attributes, #serialized_attributes
Constructor Details
This class inherits a constructor from ONIX::SubsetDSL
Instance Method Details
#bytes ⇒ Integer
bytes count
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/onix/extent.rb', line 15 def bytes case @extent_unit.human when "Bytes" @extent_value.to_i when "Kbytes" (@extent_value.to_f * 1024).to_i when "Mbytes" (@extent_value.to_f * 1024 * 1024).to_i else nil end end |
#extent_type ⇒ ExtentType
3 |
# File 'lib/onix/extent.rb', line 3 element "ExtentType", :subset, :shortcut => :type, :cardinality => 1 |
#extent_unit ⇒ ExtentUnit
6 |
# File 'lib/onix/extent.rb', line 6 element "ExtentUnit", :subset, :shortcut => :unit, :cardinality => 1 |
#extent_value ⇒ String
4 |
# File 'lib/onix/extent.rb', line 4 element "ExtentValue", :text, :shortcut => :value, :cardinality => 0..1 |
#extent_value_roman ⇒ String
5 |
# File 'lib/onix/extent.rb', line 5 element "ExtentValueRoman", :text, :cardinality => 0..1 |
#pages ⇒ Integer
pages count
30 31 32 33 34 35 36 |
# File 'lib/onix/extent.rb', line 30 def pages if @extent_unit.human == "Pages" @extent_value.to_i else nil end end |
#type ⇒ ExtentType
shortcut for #extent_type
3 |
# File 'lib/onix/extent.rb', line 3 element "ExtentType", :subset, :shortcut => :type, :cardinality => 1 |
#unit ⇒ ExtentUnit
shortcut for #extent_unit
6 |
# File 'lib/onix/extent.rb', line 6 element "ExtentUnit", :subset, :shortcut => :unit, :cardinality => 1 |
#value ⇒ String
shortcut for #extent_value
4 |
# File 'lib/onix/extent.rb', line 4 element "ExtentValue", :text, :shortcut => :value, :cardinality => 0..1 |