Class: Rufus::Decision::HashFilter

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

Overview

In the Java world, this class would be considered abstract.

It’s used to build sequences of filter on hashes (or instances that respond to the [], []=, has_key? methods).

It relies on ‘prefixed string keys’ like “x:y”, where the prefix is ‘x’ and the partial key is then ‘y’.

Rufus::EvalHashFilter is an implementation of an HashFilter.

Direct Known Subclasses

EvalHashFilter

Instance Attribute Summary

Instance Method Summary

Constructor Details

- (HashFilter) initialize(parent_hash)

A new instance of HashFilter



48
49
50
51
# File 'lib/rufus/decision/hashes.rb', line 48

def initialize (parent_hash)

  @parent_hash = parent_hash
end

Instance Attribute Details

- (Object) parent_hash (readonly)

Returns the value of attribute parent_hash



46
47
48
# File 'lib/rufus/decision/hashes.rb', line 46

def parent_hash
  @parent_hash
end

Instance Method Details

- (Object) [](key)



53
54
55
56
57
58
# File 'lib/rufus/decision/hashes.rb', line 53

def [] (key)

  p, k = do_split(key)

  do_lookup(key, p, k)
end

- (Object) []=(key, value)



60
61
62
63
64
65
# File 'lib/rufus/decision/hashes.rb', line 60

def []= (key, value)

  p, v = do_split(value)

  do_put(key, value, p, v)
end