Class: Imagen::Node::Root
- Inherits:
-
Base
- Object
- Base
- Imagen::Node::Root
show all
- Defined in:
- lib/imagen/node.rb
Overview
Root node for a given directory
Instance Attribute Summary collapse
Attributes inherited from Base
#ast_node, #children, #name
Instance Method Summary
collapse
Methods inherited from Base
#empty_def?, #find_all, #initialize, #line_numbers, #source_lines, #source_lines_with_numbers
Instance Attribute Details
#dir ⇒ Object
Returns the value of attribute dir.
71
72
73
|
# File 'lib/imagen/node.rb', line 71
def dir
@dir
end
|
Instance Method Details
#build_from_ast(ast_node) ⇒ Object
90
91
92
93
|
# File 'lib/imagen/node.rb', line 90
def build_from_ast(ast_node)
Imagen::Visitor.traverse(ast_node, self)
self
end
|
#build_from_dir(dir) ⇒ Object
80
81
82
83
84
85
86
87
88
|
# File 'lib/imagen/node.rb', line 80
def build_from_dir(dir)
@dir = dir
list_files.each do |path|
Imagen::Visitor.traverse(Imagen::AST::Parser.parse_file(path), self)
rescue Parser::SyntaxError => e
warn "#{path}: #{e} #{e.message}"
end
self
end
|
#build_from_file(path) ⇒ Object
73
74
75
76
77
78
|
# File 'lib/imagen/node.rb', line 73
def build_from_file(path)
Imagen::Visitor.traverse(Imagen::AST::Parser.parse_file(path), self)
rescue Parser::SyntaxError => e
warn "#{path}: #{e} #{e.message}"
self
end
|
#file_path ⇒ Object
TODO: fix wrong inheritance
100
101
102
|
# File 'lib/imagen/node.rb', line 100
def file_path
dir
end
|
#first_line ⇒ Object
104
105
106
|
# File 'lib/imagen/node.rb', line 104
def first_line
nil
end
|
#human_name ⇒ Object
95
96
97
|
# File 'lib/imagen/node.rb', line 95
def human_name
'root'
end
|
#last_line ⇒ Object
108
109
110
|
# File 'lib/imagen/node.rb', line 108
def last_line
nil
end
|
#source ⇒ Object
112
113
114
|
# File 'lib/imagen/node.rb', line 112
def source
nil
end
|