Class: Rufus::Decision::EvalHashFilter

Inherits:
HashFilter
  • Object
show all
Defined in:
lib/rufus/decision/hashes.rb

Overview

Implements the r:, ruby: and reval: prefixes in lookups

  require 'rubygems'
  require 'rufus/hashes'

  h = {}

  eh = Rufus::EvalHashFilter.new(h, 0)

  eh['a'] = :a
  p h # => { 'a' => :a }

  eh['b'] = "r:5 * 5"
  p h # => { 'a' => :a, 'b' => 25 }

  assert_equal :a, eh['a']
  assert_equal 25, eh['b']
  assert_equal 72, eh['r:36+36']

Constant Summary

RP =
%w{ r

Instance Method Summary

Methods inherited from HashFilter

#[], #[]=

Constructor Details

- (EvalHashFilter) initialize(parent_hash)

A new instance of EvalHashFilter



146
147
148
149
# File 'lib/rufus/decision/hashes.rb', line 146

def initialize (parent_hash)

  super(parent_hash)
end