Class: Rumld::Graph

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/rumld/graph.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(doc_dir, source_dirs = [], files = []) ⇒ Graph

Returns a new instance of Graph.



5
6
7
8
9
# File 'lib/rumld/graph.rb', line 5

def initialize(doc_dir, source_dirs = [], files = [])
  self.doc_dir = doc_dir
  self.source_dirs = source_dirs
  self.files = files
end

Instance Attribute Details

#doc_dirObject

Returns the value of attribute doc_dir.



3
4
5
# File 'lib/rumld/graph.rb', line 3

def doc_dir
  @doc_dir
end

#filesObject

Returns the value of attribute files.



3
4
5
# File 'lib/rumld/graph.rb', line 3

def files
  @files
end

#source_dirsObject

Returns the value of attribute source_dirs.



3
4
5
# File 'lib/rumld/graph.rb', line 3

def source_dirs
  @source_dirs
end

Instance Method Details

#files_to_processObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rumld/graph.rb', line 12

def files_to_process
  unless @files_to_process
    @files_to_process  = []
    source_dirs.each do |dir|
      files.each { |file| @files_to_process += Dir.glob(File.join(dir, '**', file)) } if files
    end
    @files_to_process.uniq!
    @files_to_process.each{|f| require f}
  end
  @files_to_process
end

#treeObject



24
25
26
# File 'lib/rumld/graph.rb', line 24

def tree
  @tree ||= Rumld::Tree.new(self, defined_constant_names)
end