Class: Mongomatic::TypeConverters::Base
- Inherits:
-
Object
- Object
- Mongomatic::TypeConverters::Base
show all
- Defined in:
- lib/mongomatic/type_converters.rb
Instance Method Summary
collapse
Constructor Details
#initialize(orig_val) ⇒ Base
Returns a new instance of Base.
10
11
12
|
# File 'lib/mongomatic/type_converters.rb', line 10
def initialize(orig_val)
@orig_val = orig_val
end
|
Instance Method Details
#cast ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/mongomatic/type_converters.rb', line 18
def cast
if type_match?
@orig_val
else
convert_orig_val || raise(CannotCastValue)
end
end
|
#convert_orig_val ⇒ Object
26
27
28
|
# File 'lib/mongomatic/type_converters.rb', line 26
def convert_orig_val
raise "abstract"
end
|
#type_match? ⇒ Boolean
14
15
16
|
# File 'lib/mongomatic/type_converters.rb', line 14
def type_match?
raise "abstract"
end
|