module Ethon::Multi::Options

def value_for(value, type, option = nil)

Returns:
  • (Object) - The casted value.

Other tags:
    Example: Return casted the value. -
def value_for(value, type, option = nil)
  return nil if value.nil?
  if type == :bool
    value ? 1 : 0
  elsif type == :int
    value.to_i
  elsif value.is_a?(String)
    Ethon::Easy::Util.escape_zero_byte(value)
  else
    value
  end
end