class Imagen::Node::Root
Root
node for a given directory
Attributes
dir[R]
Public Instance Methods
build_from_dir(dir)
click to toggle source
# 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)
click to toggle source
# 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()
click to toggle source
TODO: fix wrong inheritance
# File lib/imagen/node.rb, line 93 def file_path dir end
first_line()
click to toggle source
# File lib/imagen/node.rb, line 97 def first_line nil end
human_name()
click to toggle source
# File lib/imagen/node.rb, line 88 def human_name 'root' end
last_line()
click to toggle source
# File lib/imagen/node.rb, line 101 def last_line nil end
source()
click to toggle source
# File lib/imagen/node.rb, line 105 def source nil end
Private Instance Methods
list_files()
click to toggle source
# File lib/imagen/node.rb, line 111 def list_files return [dir] if File.file?(dir) Dir.glob("#{dir}/**/*.rb").reject { |path| path =~ Imagen::EXCLUDE_RE } end