Class: Compath::Dumper
- Inherits:
-
Object
- Object
- Compath::Dumper
- Defined in:
- lib/compath/dumper.rb
Instance Method Summary collapse
- #dump ⇒ Object (also: #dump_hash)
- #dump_yaml ⇒ Object
-
#initialize(paths) ⇒ Dumper
constructor
A new instance of Dumper.
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
#dump ⇒ Object 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_yaml ⇒ Object
19 20 21 |
# File 'lib/compath/dumper.rb', line 19 def dump_yaml YAML.dump(dump_hash) end |