Class: Extant::Coercers::Base
- Inherits:
-
Object
- Object
- Extant::Coercers::Base
- Defined in:
- lib/extant/coercers/base.rb
Direct Known Subclasses
Array, Boolean, DateTime, Fixnum, Float, Hash, Integer, String, Symbol, Time, Uuid
Constant Summary collapse
- UncoercedValue =
Extant::UncoercedValue
Class Method Summary collapse
Instance Method Summary collapse
- #coerce ⇒ Object
- #coerced? ⇒ Boolean
-
#initialize(value, options = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(value, options = {}) ⇒ Base
Returns a new instance of Base.
9 10 11 12 13 |
# File 'lib/extant/coercers/base.rb', line 9 def initialize(value, ={}) self.value = value self.coerced = false self. = {} end |
Class Method Details
.coercer_name ⇒ Object
5 6 7 |
# File 'lib/extant/coercers/base.rb', line 5 def self.coercer_name self.name.split("::").last.gsub(/([a-z\d])([A-Z])/,'\1_\2').downcase end |
Instance Method Details
#coerce ⇒ Object
15 16 17 |
# File 'lib/extant/coercers/base.rb', line 15 def coerce rase NotImplementedError.new("#{self.class.name} must implement #{coerce}") end |