class Phi::Losophy::Page::Node
Attributes
in_parentheses[RW]
parent[R]
Public Class Methods
new(parent)
click to toggle source
# File lib/phi/losophy/page/node.rb, line 8 def initialize(parent) @parent = parent end
Public Instance Methods
anchor()
click to toggle source
# File lib/phi/losophy/page/node.rb, line 12 def anchor parent.children.each do |child| if child.name == 'text' text(child) elsif child.name == 'a' && out_of_parentheses? return child end end end
out_of_parentheses?()
click to toggle source
# File lib/phi/losophy/page/node.rb, line 32 def out_of_parentheses? !in_parentheses end
text(node)
click to toggle source
# File lib/phi/losophy/page/node.rb, line 22 def text(node) node.text.split('').each { |c| if c == '(' self.in_parentheses = true elsif c == ')' self.in_parentheses = false end } end