Class: Rabarber::Input::Base
- Inherits:
-
Object
- Object
- Rabarber::Input::Base
- Defined in:
- lib/rabarber/input/base.rb
Direct Known Subclasses
Action, AuthorizationContext, Context, DynamicRule, Role, Roles, Types::Boolean, Types::Proc, Types::Symbol
Instance Attribute Summary collapse
-
#error_message ⇒ Object
readonly
Returns the value of attribute error_message.
-
#error_type ⇒ Object
readonly
Returns the value of attribute error_type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value, error_type = Rabarber::InvalidArgumentError, error_message = nil) ⇒ Base
constructor
A new instance of Base.
- #process ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(value, error_type = Rabarber::InvalidArgumentError, error_message = nil) ⇒ Base
Returns a new instance of Base.
8 9 10 11 12 |
# File 'lib/rabarber/input/base.rb', line 8 def initialize(value, error_type = Rabarber::InvalidArgumentError, = nil) @value = value @error_type = error_type @error_message = || end |
Instance Attribute Details
#error_message ⇒ Object (readonly)
Returns the value of attribute error_message.
6 7 8 |
# File 'lib/rabarber/input/base.rb', line 6 def @error_message end |
#error_type ⇒ Object (readonly)
Returns the value of attribute error_type.
6 7 8 |
# File 'lib/rabarber/input/base.rb', line 6 def error_type @error_type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/rabarber/input/base.rb', line 6 def value @value end |
Instance Method Details
#process ⇒ Object
14 15 16 |
# File 'lib/rabarber/input/base.rb', line 14 def process valid? ? processed_value : raise_error end |
#valid? ⇒ Boolean
18 19 20 |
# File 'lib/rabarber/input/base.rb', line 18 def valid? raise NotImplementedError end |