Class: ONIX::Extent

Inherits:
SubsetDSL show all
Defined in:
lib/onix/extent.rb

Instance Attribute Summary

Attributes included from Attributes

#attributes

High level collapse

Low level collapse

Shortcuts collapse

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

#bytesInteger

bytes count

Returns:

  • (Integer)


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_typeExtentType

Returns:



3
# File 'lib/onix/extent.rb', line 3

element "ExtentType", :subset, :shortcut => :type, :cardinality => 1

#extent_unitExtentUnit

Returns:



6
# File 'lib/onix/extent.rb', line 6

element "ExtentUnit", :subset, :shortcut => :unit, :cardinality => 1

#extent_valueString

Returns:

  • (String)


4
# File 'lib/onix/extent.rb', line 4

element "ExtentValue", :text, :shortcut => :value, :cardinality => 0..1

#extent_value_romanString

Returns:

  • (String)


5
# File 'lib/onix/extent.rb', line 5

element "ExtentValueRoman", :text, :cardinality => 0..1

#pagesInteger

pages count

Returns:

  • (Integer)


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

#typeExtentType

shortcut for #extent_type

Returns:



3
# File 'lib/onix/extent.rb', line 3

element "ExtentType", :subset, :shortcut => :type, :cardinality => 1

#unitExtentUnit

shortcut for #extent_unit

Returns:



6
# File 'lib/onix/extent.rb', line 6

element "ExtentUnit", :subset, :shortcut => :unit, :cardinality => 1

#valueString

shortcut for #extent_value

Returns:

  • (String)


4
# File 'lib/onix/extent.rb', line 4

element "ExtentValue", :text, :shortcut => :value, :cardinality => 0..1