Class: Codec::Numace
Instance Method Summary collapse
Methods inherited from Numstr
Methods inherited from Fix
#check_length, #decode, #initialize
Methods inherited from Base
#add_sub_codec, #decode, #encode, #get_sub_codecs
Constructor Details
This class inherits a constructor from Codec::Fix
Instance Method Details
#build_field(buffer, field, length) ⇒ Object
181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/codec/fix.rb', line 181 def build_field(buffer, field, length) data = "" buf = buffer.slice!(0...length) # if buf to decode is in EBCDIC then convert buf in ASCII if ( buf.unpack("C*").select{|c| c >= 128}.size > 0) buf.unpack("C*").each { |c| data << EBCDIC_2_ASCII[c] } else data = buf end field.set_value(data.to_i) end |