Class: Highway::Steps::Parameters::Base
- Inherits:
-
Object
- Object
- Highway::Steps::Parameters::Base
- Defined in:
- lib/highway/steps/parameters/base.rb
Overview
This class is a base abstract class for other classes in this module. You should not use it directly.
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
Name of the parameter.
Instance Method Summary collapse
-
#initialize ⇒ Base
constructor
Initialize an instance.
-
#is_required? ⇒ Boolean
Whether the parameter is required.
-
#typecheck_and_validate(value, interface:, keypath: []) ⇒ Object
Typecheck and validate a value of the parameter.
Constructor Details
#initialize ⇒ Base
Initialize an instance.
17 18 19 |
# File 'lib/highway/steps/parameters/base.rb', line 17 def initialize() raise NotImplementedError.new("You must not call `#{__method__.to_s}` on `#{self.class.to_s}`.") end |
Instance Attribute Details
#name ⇒ String (readonly)
Name of the parameter.
24 25 26 |
# File 'lib/highway/steps/parameters/base.rb', line 24 def name @name end |
Instance Method Details
#is_required? ⇒ Boolean
Whether the parameter is required.
29 30 31 |
# File 'lib/highway/steps/parameters/base.rb', line 29 def is_required? @required end |
#typecheck_and_validate(value, interface:, keypath: []) ⇒ Object
Typecheck and validate a value of the parameter.
This method returns typechecked, coerced and validated value or raises a fatal error if value has invalid type, can’t be coerced or is othweriwse invalid.
44 45 46 |
# File 'lib/highway/steps/parameters/base.rb', line 44 def typecheck_and_validate(value, interface:, keypath: []) raise NotImplementedError.new("You must override `#{__method__.to_s}` in `#{self.class.to_s}`.") end |