class Daedalus::DependencyGrapher::IncludedFile
Attributes
includes[R]
name[R]
Public Class Methods
cache()
click to toggle source
# File lib/daedalus/dependency_grapher.rb 185 def self.cache 186 @cache ||= {} 187 end
new(name, parser)
click to toggle source
Calls superclass method
Daedalus::DependencyGrapher::Container::new
# File lib/daedalus/dependency_grapher.rb 189 def initialize(name, parser) 190 super parser 191 @name = name 192 @includes = [] 193 end
Public Instance Methods
collect_dependencies(set)
click to toggle source
# File lib/daedalus/dependency_grapher.rb 228 def collect_dependencies(set) 229 return if set.include? @name 230 231 set << @name 232 @includes.each { |x| x.collect_dependencies(set) } 233 end
execute(defines, node)
click to toggle source
# File lib/daedalus/dependency_grapher.rb 212 def execute(defines, node) 213 expand_filename(node) 214 215 if cached = self.class.cache[@name.to_sym] 216 @body = cached.body 217 else 218 parser = FileParser.new self, @parser.directories 219 parser.parse_file @name 220 self.class.cache[@name.to_sym] = self 221 end 222 223 execute_body defines, self 224 225 node.includes << self 226 end
expand_filename(node)
click to toggle source
# File lib/daedalus/dependency_grapher.rb 195 def expand_filename(node) 196 return if File.exist? @name 197 198 @parser.directories.each do |dir| 199 path = File.join dir, @name 200 return @name = path if File.file? path 201 end 202 203 # Try to find the file in the same directory as where we're looking from 204 dir = File.dirname(node.name) 205 path = File.join dir, @name 206 207 return @name = path if File.file?(path) 208 209 raise Errno::ENOENT, "unable to find file to include: #{@name} from #{node.name}" 210 end