Class: Nodepile::RuleRecordEvaluator::HashMask

Inherits:
Object
  • Object
show all
Defined in:
lib/nodepile/rule_eval.rb

Overview

Utility class

Instance Method Summary collapse

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

Returns:

  • (Boolean)


133
# File 'lib/nodepile/rule_eval.rb', line 133

def include?(k) = @h.include?(k)