Class: Compath::Dumper

Inherits:
Object
  • Object
show all
Defined in:
lib/compath/dumper.rb

Instance Method Summary collapse

Constructor Details

#initialize(paths) ⇒ Dumper

Returns a new instance of Dumper.



3
4
5
6
7
# File 'lib/compath/dumper.rb', line 3

def initialize(paths)
  @paths = paths.each_with_object({}) do |path, hash|
    hash[path] = Guide.new(path)
  end
end

Instance Method Details

#dumpObject Also known as: dump_hash



9
10
11
12
13
14
15
16
# File 'lib/compath/dumper.rb', line 9

def dump
  @paths.values.map do |path|
    scan_target = true
    scan_target = path.ancestors.all?(&:scan_children)
    next unless scan_target
    path.to_object
  end.compact
end

#dump_yamlObject



19
20
21
# File 'lib/compath/dumper.rb', line 19

def dump_yaml
  YAML.dump(dump_hash)
end