Class: BPS::Coercer
- Inherits:
-
Object
- Object
- BPS::Coercer
- Defined in:
- lib/bps/coercer.rb
Constant Summary collapse
- TRUE_VALUES =
[true, 'TRUE', 'true', 'T', 't', 1, '1'].to_set
Instance Attribute Summary collapse
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
Instance Method Summary collapse
- #coerce(hash) ⇒ Object
-
#initialize(schema) ⇒ Coercer
constructor
A new instance of Coercer.
Constructor Details
#initialize(schema) ⇒ Coercer
Returns a new instance of Coercer.
9 10 11 12 |
# File 'lib/bps/coercer.rb', line 9 def initialize(schema) validate!(schema) @schema = schema end |
Instance Attribute Details
#schema ⇒ Object (readonly)
Returns the value of attribute schema.
7 8 9 |
# File 'lib/bps/coercer.rb', line 7 def schema @schema end |
Instance Method Details
#coerce(hash) ⇒ Object
14 15 16 |
# File 'lib/bps/coercer.rb', line 14 def coerce(hash) coerce_with(@schema, hash) end |