Class: Multisync::Catalog

Inherits:
Object
  • Object
show all
Defined in:
lib/multisync/catalog.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Catalog

Returns a new instance of Catalog.



6
7
8
# File 'lib/multisync/catalog.rb', line 6

def initialize path
  @path = File.expand_path(path)
end

Instance Attribute Details

#definitionObject (readonly)

top entity of definition



4
5
6
# File 'lib/multisync/catalog.rb', line 4

def definition
  @definition
end

Class Method Details

.default_catalog_pathObject



26
27
28
# File 'lib/multisync/catalog.rb', line 26

def self.default_catalog_path
  '~/.multisync.rb'
end

Instance Method Details

#pathObject

Raises:

  • (RuntimeError.new)


20
21
22
23
24
# File 'lib/multisync/catalog.rb', line 20

def path
  return @path if File.exist? @path
  sample_path = File.expand_path('../../../sample/multisync.rb', __FILE__)
  raise RuntimeError.new, "No catalog found at #{@path}. Copy sample from #{sample_path} to #{@path} and adjust to your needs."
end

#traverse(visitor) ⇒ Object



16
17
18
# File 'lib/multisync/catalog.rb', line 16

def traverse visitor
  definition.accept visitor
end