Class: ONIX::Extent

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

Instance Method Summary collapse

Methods inherited from SubsetDSL

_ancestor_registered_scopes, _ancestors_registered_elements, ancestor_registered_scopes, ancestors_registered_elements, element, elements, get_class, #initialize, #parse, ref_to_short, registered_elements, registered_scopes, scope, short_to_ref, #unsupported

Methods inherited from Subset

parse, #parse, tag_match, #tag_match, #unsupported

Constructor Details

This class inherits a constructor from ONIX::SubsetDSL

Instance Method Details

#bytesObject



270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/onix/descriptive_detail.rb', line 270

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

#pagesObject



283
284
285
286
287
288
289
# File 'lib/onix/descriptive_detail.rb', line 283

def pages
  if @extent_unit.human=="Pages"
    @extent_value.to_i
  else
    nil
  end
end

#typeObject

shortcuts



258
259
260
# File 'lib/onix/descriptive_detail.rb', line 258

def type
  @extent_type
end

#unitObject



262
263
264
# File 'lib/onix/descriptive_detail.rb', line 262

def unit
  @extent_unit
end

#valueObject



266
267
268
# File 'lib/onix/descriptive_detail.rb', line 266

def value
  @extent_value
end