Class: HashFilter::Operation
- Inherits:
-
Object
- Object
- HashFilter::Operation
- Defined in:
- lib/hash_filter/operation.rb,
lib/hash_filter/operation/delete.rb,
lib/hash_filter/operation/rename.rb
Overview
An abstract operation on a hash during the filter process
Defined Under Namespace
Instance Method Summary collapse
-
#execute(hash, key) ⇒ Object
Execute the defined operation.
-
#initialize(key) ⇒ Operation
constructor
A new operation.
-
#matches?(key) ⇒ Boolean
Should this operation be executed?.
Constructor Details
#initialize(key) ⇒ Operation
A new operation
19 20 21 |
# File 'lib/hash_filter/operation.rb', line 19 def initialize(key) @key = key end |
Instance Method Details
#execute(hash, key) ⇒ Object
Execute the defined operation
29 30 31 |
# File 'lib/hash_filter/operation.rb', line 29 def execute(hash, key) raise NotImplementedError end |
#matches?(key) ⇒ Boolean
Should this operation be executed?
36 37 38 |
# File 'lib/hash_filter/operation.rb', line 36 def matches?(key) @key === key end |