Module: SMG::Mapping::TypeCasts

Defined in:
lib/smg/mapping/typecasts.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.typecastsObject

Returns the value of attribute typecasts.



10
11
12
# File 'lib/smg/mapping/typecasts.rb', line 10

def typecasts
  @typecasts
end

Class Method Details

.[](key, value) ⇒ Object

Raises:

  • (ArgumentError)


12
13
14
15
# File 'lib/smg/mapping/typecasts.rb', line 12

def [](key,value)
  return typecasts[key][value] if typecasts.key?(key)
  raise ArgumentError, "Can't typecast #{value.class} into #{key.inspect}"
end

.key?(key) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/smg/mapping/typecasts.rb', line 17

def key?(key)
  typecasts.key?(key)
end