Class: Blood::Node

Inherits:
Object
  • Object
show all
Includes:
TreeHtml
Defined in:
lib/blood.rb

Instance Method Summary collapse

Constructor Details

#initialize(mod, hier) ⇒ Node

Returns a new instance of Node.



47
48
49
50
# File 'lib/blood.rb', line 47

def initialize(mod, hier)
  @mod = mod
  @hier = hier
end

Instance Method Details

#children_for_tree_htmlObject



57
58
59
# File 'lib/blood.rb', line 57

def children_for_tree_html
  children.map{ |sub| Node.new(sub, @hier) }
end

#css_for_tree_htmlObject



61
62
63
# File 'lib/blood.rb', line 61

def css_for_tree_html
  '.hl{color: #cc342d;}'
end

#label_for_tree_htmlObject



52
53
54
55
# File 'lib/blood.rb', line 52

def label_for_tree_html
  name = ::CGI.escapeHTML(@mod.to_s)
  Class === @mod ? "<span class='hl'>#{name}</span>" : name
end