Class: LooseErbs::Graph::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/loose_erbs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#childrenObject (readonly)

Returns the value of attribute children.



142
143
144
# File 'lib/loose_erbs.rb', line 142

def children
  @children
end

#identifierObject (readonly)

Returns the value of attribute identifier.



142
143
144
# File 'lib/loose_erbs.rb', line 142

def identifier
  @identifier
end

#parentsObject (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

Returns:

  • (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

Returns:

  • (Boolean)


163
164
165
# File 'lib/loose_erbs.rb', line 163

def partial?
  Pathname.new(identifier).basename.to_s.start_with?("_")
end


167
168
169
# File 'lib/loose_erbs.rb', line 167

def print
  puts identifier
end


171
172
173
# File 'lib/loose_erbs.rb', line 171

def print_tree
  Printer.new(self).print_tree
end