Method: Flt::Bytes#initialize

Defined in:
lib/float-formats/bytes.rb

#initialize(bytes) ⇒ Bytes



105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/float-formats/bytes.rb', line 105

def initialize(bytes)
  case bytes
    when Bytes
      @bytes = bytes.to_s
    when Array
      @bytes = bytes.pack("C*")
    else
      @bytes = bytes.to_str
  end
  @bytes.force_encoding("BINARY") if @bytes.respond_to?(:force_encoding)
  super @bytes
end