Class: Nodepile::RuleRecordEvaluator::HashMask
- Inherits:
-
Object
- Object
- Nodepile::RuleRecordEvaluator::HashMask
- Defined in:
- lib/nodepile/rule_eval.rb
Overview
Utility class
Instance Method Summary collapse
- #[](k) ⇒ Object
- #include?(k) ⇒ Boolean
-
#initialize(hashlike, this_key) ⇒ HashMask
constructor
A new instance of HashMask.
Constructor Details
#initialize(hashlike, this_key) ⇒ HashMask
Returns a new instance of HashMask.
128 129 130 131 |
# File 'lib/nodepile/rule_eval.rb', line 128 def initialize(hashlike,this_key) @h = hashlike @tk = this_key end |
Instance Method Details
#[](k) ⇒ Object
134 135 136 137 |
# File 'lib/nodepile/rule_eval.rb', line 134 def [](k) raise "Unable to use v[:this] because :this was not set" if k == :this && @tk.nil? @h[k == :this ? @tk : k] end |
#include?(k) ⇒ Boolean
133 |
# File 'lib/nodepile/rule_eval.rb', line 133 def include?(k) = @h.include?(k) |