Class: RailsSimpleParams::Coercion::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_simple_params/coercion/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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 = options
  @type = type
  argument_validation
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/rails_simple_params/coercion/base.rb', line 6

def options
  @options
end

#paramObject (readonly)

Returns the value of attribute param.



6
7
8
# File 'lib/rails_simple_params/coercion/base.rb', line 6

def param
  @param
end

#typeObject (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

#coerceObject

Raises:

  • (NotImplementedError)


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