Method: Fix::Protocol::Field#from_type

Defined in:
lib/fix/protocol/field.rb

#from_type(obj) ⇒ String

Performs the actual mapping or type casting by converting an object to a string or a symbol to a mapped string

Parameters:

  • obj (Object)

    The mapping key or object to convert

Returns:

  • (String)

    The FIX field value



111
112
113
114
115
116
117
118
119
# File 'lib/fix/protocol/field.rb', line 111

def from_type(obj)
  if !obj.nil? && type && !mapping
    send("dump_#{type}", obj)
  elsif !obj.nil? && mapping && mapping.has_key?(obj)
    mapping[obj]
  else
    obj
  end
end