Class: Findable::Schema::Conversion
- Inherits:
-
Object
- Object
- 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 22 |
# File 'lib/findable/schema/conversion.rb', line 18 def add_type!(type) return type if type.respond_to?(:call) raise ArgumentError unless private_method_defined?(type) types[type.to_sym] = method(type) end |
.for(type) ⇒ Object
7 8 9 10 |
# File 'lib/findable/schema/conversion.rb', line 7 def for(type) return types[:default] if type.nil? types[type] || 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 |