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.



24
25
26
27
# File 'lib/blood.rb', line 24

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

Instance Method Details

#children_for_tree_htmlObject



34
35
36
# File 'lib/blood.rb', line 34

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

#css_for_tree_htmlObject



38
39
40
# File 'lib/blood.rb', line 38

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

#label_for_tree_htmlObject



29
30
31
32
# File 'lib/blood.rb', line 29

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