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
#build_from_ast, #find_all, #initialize, #line_numbers, #source_lines, #source_lines_with_numbers
Instance Attribute Details
#dir ⇒ Object
Returns the value of attribute dir.
67
68
69
|
# File 'lib/imagen/node.rb', line 67
def dir
@dir
end
|
Instance Method Details
#build_from_dir(dir) ⇒ Object
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/imagen/node.rb', line 76
def build_from_dir(dir)
@dir = dir
list_files.each do |path|
begin
Imagen::Visitor.traverse(Imagen::AST::Parser.parse_file(path), self)
rescue Parser::SyntaxError => err
warn "#{path}: #{err} #{err.message}"
end
end
self
end
|
#build_from_file(path) ⇒ Object
69
70
71
72
73
74
|
# File 'lib/imagen/node.rb', line 69
def build_from_file(path)
Imagen::Visitor.traverse(Imagen::AST::Parser.parse_file(path), self)
rescue Parser::SyntaxError => err
warn "#{path}: #{err} #{err.message}"
self
end
|
#file_path ⇒ Object
TODO: fix wrong inheritance
93
94
95
|
# File 'lib/imagen/node.rb', line 93
def file_path
dir
end
|
#first_line ⇒ Object
97
98
99
|
# File 'lib/imagen/node.rb', line 97
def first_line
nil
end
|
#human_name ⇒ Object
88
89
90
|
# File 'lib/imagen/node.rb', line 88
def human_name
'root'
end
|
#last_line ⇒ Object
101
102
103
|
# File 'lib/imagen/node.rb', line 101
def last_line
nil
end
|
#source ⇒ Object
105
106
107
|
# File 'lib/imagen/node.rb', line 105
def source
nil
end
|