lib/dumpdb/settings.rb in dumpdb-1.1.0 vs lib/dumpdb/settings.rb in dumpdb-2.0.0

- old
+ new

@@ -1,6 +1,5 @@ -require 'yaml' require 'dumpdb/db' module Dumpdb::Settings class Base @@ -17,31 +16,17 @@ end class Ssh < Base; end - class Databases < Base - - def value(script) - val = super - val.kind_of?(::String) ? load_yaml(val) : val - end - - private - - def load_yaml(file_path) - YAML.load(File.read(File.expand_path(file_path))) - end - end - class DumpFile < Base; end class SourceTarget < Base def value(script) - val = super - val.kind_of?(Dumpdb::Db) ? val : Dumpdb::Db.new(script.dump_file, val) + hash = super + Dumpdb::Db.new(script.dump_file, hash) end end class Cmd < Base @@ -51,11 +36,11 @@ end private def hsub(string, hash) - hash.inject(string) {|new_str, (k, v)| new_str.gsub(":#{k}", v.to_s)} + hash.inject(string){ |new_str, (k, v)| new_str.gsub(":#{k}", v.to_s) } end end class DumpCmd < Cmd @@ -92,10 +77,10 @@ end class CmdList < ::Array def value(script, placeholder_vals={}) - self.map{|cmd| cmd.value(script, placeholder_vals)} + self.map{ |cmd| cmd.value(script, placeholder_vals) } end end end