Module: LiabilityProof::Tree::Node

Included in:
InteriorNode, LeafNode
Defined in:
lib/liability-proof/tree/node.rb

Instance Method Summary collapse

Instance Method Details

#as_json(use_float = false) ⇒ Object



6
7
8
# File 'lib/liability-proof/tree/node.rb', line 6

def as_json(use_float=false)
  { 'value' => formatted_value(use_float), 'hash' => hash }
end

#formatted_value(use_float) ⇒ Object



14
15
16
# File 'lib/liability-proof/tree/node.rb', line 14

def formatted_value(use_float)
  use_float ? value.to_f : value_string
end

#value_stringObject



10
11
12
# File 'lib/liability-proof/tree/node.rb', line 10

def value_string
  value.to_s('F')
end