Class: Mato::Rescue
- Inherits:
-
Object
- Object
- Mato::Rescue
- Defined in:
- lib/mato/rescue.rb
Instance Attribute Summary collapse
-
#filter ⇒ Object
readonly
Returns the value of attribute filter.
-
#on_error ⇒ Object
readonly
Returns the value of attribute on_error.
Instance Method Summary collapse
- #call(content) ⇒ Object
-
#initialize(filter, on_error:) ⇒ Rescue
constructor
A new instance of Rescue.
Constructor Details
#initialize(filter, on_error:) ⇒ Rescue
Returns a new instance of Rescue.
8 9 10 11 |
# File 'lib/mato/rescue.rb', line 8 def initialize(filter, on_error:) @filter = filter @on_error = on_error end |
Instance Attribute Details
#filter ⇒ Object (readonly)
Returns the value of attribute filter.
5 6 7 |
# File 'lib/mato/rescue.rb', line 5 def filter @filter end |
#on_error ⇒ Object (readonly)
Returns the value of attribute on_error.
6 7 8 |
# File 'lib/mato/rescue.rb', line 6 def on_error @on_error end |
Instance Method Details
#call(content) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/mato/rescue.rb', line 13 def call(content) filter.call(content) rescue => e on_error.call(e) content end |