Module: Packable::Extensions::Float

Defined in:
lib/packable/extensions/float.rb

Overview

:nodoc:

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/packable/extensions/float.rb', line 4

def self.included(base)
  base.class_eval do
    include Packable
    extend ClassMethods
    packers do |p|
      p.set :merge_all, :precision => :single, :endian => :big
      p.set :double   , :precision => :double
      p.set :float    , {}
      p.set :default  , :float
    end
  end
end

Instance Method Details

#write_packed(io, options) ⇒ Object



17
18
19
# File 'lib/packable/extensions/float.rb', line 17

def write_packed(io, options)
  io << pack(self.class.pack_option_to_format(options))
end