Class: LooseErbs::Graph::Node
- Inherits:
-
Object
- Object
- LooseErbs::Graph::Node
- Defined in:
- lib/loose_erbs.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#parents ⇒ Object
readonly
Returns the value of attribute parents.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
-
#initialize(identifier) ⇒ Node
constructor
A new instance of Node.
- #loose? ⇒ Boolean
- #not_loose! ⇒ Object
- #partial? ⇒ Boolean
- #print ⇒ Object
- #print_tree ⇒ Object
Constructor Details
#initialize(identifier) ⇒ Node
Returns a new instance of Node.
144 145 146 147 148 149 |
# File 'lib/loose_erbs.rb', line 144 def initialize(identifier) @identifier = identifier @children = [] @parents = [] @loose = true end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
142 143 144 |
# File 'lib/loose_erbs.rb', line 142 def children @children end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
142 143 144 |
# File 'lib/loose_erbs.rb', line 142 def identifier @identifier end |
#parents ⇒ Object (readonly)
Returns the value of attribute parents.
142 143 144 |
# File 'lib/loose_erbs.rb', line 142 def parents @parents end |
Instance Method Details
#accept(visitor) ⇒ Object
151 152 153 |
# File 'lib/loose_erbs.rb', line 151 def accept(visitor) visitor.visit(self) end |
#loose? ⇒ Boolean
155 156 157 |
# File 'lib/loose_erbs.rb', line 155 def loose? @loose end |
#not_loose! ⇒ Object
159 160 161 |
# File 'lib/loose_erbs.rb', line 159 def not_loose! @loose = false end |
#partial? ⇒ Boolean
163 164 165 |
# File 'lib/loose_erbs.rb', line 163 def partial? Pathname.new(identifier).basename.to_s.start_with?("_") end |
#print ⇒ Object
167 168 169 |
# File 'lib/loose_erbs.rb', line 167 def print puts identifier end |
#print_tree ⇒ Object
171 172 173 |
# File 'lib/loose_erbs.rb', line 171 def print_tree Printer.new(self).print_tree end |