Class: RailsSimpleParams::Coercion::Base
- Inherits:
-
Object
- Object
- RailsSimpleParams::Coercion::Base
- Defined in:
- lib/rails_simple_params/coercion/base.rb
Direct Known Subclasses
ArrayParam, BigDecimalParam, BooleanParam, FloatParam, HashParam, IntegerParam, StringParam, TimeParam
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#param ⇒ Object
readonly
Returns the value of attribute param.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #coerce ⇒ Object
-
#initialize(param:, options: nil, type: nil) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(param:, options: nil, type: nil) ⇒ Base
Returns a new instance of Base.
8 9 10 11 12 13 |
# File 'lib/rails_simple_params/coercion/base.rb', line 8 def initialize(param:, options: nil, type: nil) @param = param @options = @type = type argument_validation end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/rails_simple_params/coercion/base.rb', line 6 def @options end |
#param ⇒ Object (readonly)
Returns the value of attribute param.
6 7 8 |
# File 'lib/rails_simple_params/coercion/base.rb', line 6 def param @param end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/rails_simple_params/coercion/base.rb', line 6 def type @type end |
Instance Method Details
#coerce ⇒ Object
15 16 17 |
# File 'lib/rails_simple_params/coercion/base.rb', line 15 def coerce raise NotImplementedError, "you must implement #coerce in #{self.class.name}" end |