Class: Codec::Strace
Instance Method Summary collapse
Methods inherited from String
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
195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/codec/fix.rb', line 195 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) end |