Class: TreeFilter::Leaf

Inherits:
Struct
  • Object
show all
Includes:
JsonTerminal
Defined in:
lib/tree_filter.rb

Overview

Note:

All data structures containing this object must be filtered before

Allows different data structures to be presented dependent on whether it is explicitly selected or not. Usually used to provide a “summary” object by default, and then only include detail if explicitly asked for.

data = {'a' => TreeFilter::Leaf.new('/a', {'id' => 'a'})}

TreeFilter.new("env").filter(data)    # => {'env' => '/a'}
TreeFilter.new("env[*]").filter(data) # => {'env' => {'id' => 'a'}}

converting to JSON, otherwise you will get a stack overflow error.

Instance Attribute Summary collapse

Method Summary

Methods included from JsonTerminal

#as_json

Instance Attribute Details

#leftObject

Returns the value of attribute left

Returns:

  • (Object)

    the current value of left



46
47
48
# File 'lib/tree_filter.rb', line 46

def left
  @left
end

#rightObject

Returns the value of attribute right

Returns:

  • (Object)

    the current value of right



46
47
48
# File 'lib/tree_filter.rb', line 46

def right
  @right
end