Class: YamlStore::BlockBased::Condition
- Inherits:
-
Object
- Object
- YamlStore::BlockBased::Condition
- Defined in:
- lib/yaml_store/block_based.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#negated ⇒ Object
Returns the value of attribute negated.
Instance Method Summary collapse
-
#initialize(&block) ⇒ Condition
constructor
A new instance of Condition.
- #negated? ⇒ Boolean
- #run(record) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Condition
Returns a new instance of Condition.
8 9 10 |
# File 'lib/yaml_store/block_based.rb', line 8 def initialize(&block) self.block = block end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
4 5 6 |
# File 'lib/yaml_store/block_based.rb', line 4 def block @block end |
#negated ⇒ Object
Returns the value of attribute negated.
5 6 7 |
# File 'lib/yaml_store/block_based.rb', line 5 def negated @negated end |
Instance Method Details
#negated? ⇒ Boolean
12 13 14 |
# File 'lib/yaml_store/block_based.rb', line 12 def negated? @negated == true end |
#run(record) ⇒ Object
16 17 18 19 |
# File 'lib/yaml_store/block_based.rb', line 16 def run(record) result = block.call(record) negated? ? !result : result end |