Module: Packable::Extensions::Float::ClassMethods
- Defined in:
- lib/packable/extensions/float.rb
Overview
:nodoc:
Constant Summary collapse
- ENDIAN_TO_FORMAT =
Hash.new{|h, endian| raise ArgumentError, "Endian #{endian} is not valid. It must be one of #{h.keys.join(', ')}."}. merge!(:big => "G", :network => "G", :little => "E", :native => "D").freeze
- FORMAT_TO_SINGLE_PRECISION =
{'G' => 'g', 'E' => 'e', 'D' => 'f'}.freeze
- PRECISION =
Hash.new{|h, precision| raise ArgumentError, "Precision #{precision} is not valid. It must be one of #{h.keys.join(', ')}."}. merge!(:single => 4, :double => 8).freeze
Instance Method Summary collapse
Instance Method Details
#pack_option_to_format(options) ⇒ Object
30 31 32 33 34 |
# File 'lib/packable/extensions/float.rb', line 30 def pack_option_to_format() format = ENDIAN_TO_FORMAT[[:endian]] format = FORMAT_TO_SINGLE_PRECISION[format] if [:precision] == :single format end |