Module: DbAgile::Core::Repository::YAMLInstanceMethods

Included in:
DbAgile::Core::Repository
Defined in:
lib/dbagile/core/repository/yaml_methods.rb

Instance Method Summary collapse

Instance Method Details

#to_yaml(opts = {}) ⇒ Object

Dumps the repository to YAML



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/dbagile/core/repository/yaml_methods.rb', line 8

def to_yaml(opts = {})
  YAML::quick_emit(self, opts){|out|
    dbmap = DbAgile::Tools::OrderedHash.new
    databases.each{|db| dbmap[db.name.to_s] = db}
    out.map("tag:yaml.org,2002:map") do |map|
      map.add('version', self.version)
      map.add('databases', dbmap)
      map.add('current', self.current_db_name.to_s)
    end
  }
end