Module: Findable::Schema::Conversion
- Defined in:
- lib/findable/schema/conversion.rb
Constant Summary collapse
- FALSE_VALUE =
["false", "0"]
Class Method Summary collapse
Class Method Details
.add_type!(type) ⇒ Object
18 19 20 21 |
# File 'lib/findable/schema/conversion.rb', line 18 def add_type!(type) return type if type.is_a?(Proc) types[type.to_sym] = method(type).to_proc end |
.clear_types ⇒ Object
23 24 25 |
# File 'lib/findable/schema/conversion.rb', line 23 def clear_types @_types = nil end |
.to(type) ⇒ Object
7 8 9 10 |
# File 'lib/findable/schema/conversion.rb', line 7 def to(type) return types[:default] if type.nil? types[type.to_sym] || add_type!(type) end |
.types ⇒ Object
12 13 14 15 16 |
# File 'lib/findable/schema/conversion.rb', line 12 def types @_types ||= { default: Proc.new {|value| value } } end |