Class: Blood::Node

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

Constant Summary collapse

NORMAL_NAME =
/^[A-Z][A-Za-z0-9]*(::[A-Z][A-Za-z0-9]*)*$/

Instance Method Summary collapse

Constructor Details

#initialize(mod, hier) ⇒ Node

Returns a new instance of Node.



50
51
52
53
# File 'lib/blood.rb', line 50

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

Instance Method Details

#children_for_tree_htmlObject



75
76
77
# File 'lib/blood.rb', line 75

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

#css_for_tree_htmlObject



79
80
81
# File 'lib/blood.rb', line 79

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

#label_for_tree_htmlObject



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

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

#raw_label_for_tree_htmlObject



63
64
65
66
# File 'lib/blood.rb', line 63

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