Method: Fuelcell::Parser::BaseHandler#cast

Defined in:
lib/fuelcell/parser/base_handler.rb

#cast(type, value) ⇒ Object

Delegate the cast based on type

Parameters:

  • type (Symbol)
  • value (String)
  • raw_args (Array)

Returns:

  • casted value



112
113
114
115
116
117
118
119
120
121
# File 'lib/fuelcell/parser/base_handler.rb', line 112

def cast(type, value)
  case type
  when :numeric then cast_numeric(value)
  when :bool    then cast_bool(value)
  when :hash    then cast_hash(value)
  when :array   then cast_array(value)
  else
    value.to_s
  end
end