Class: Samidare::MySQL::TableConfig
- Inherits:
-
Object
- Object
- Samidare::MySQL::TableConfig
- Defined in:
- lib/samidare/mysql.rb
Instance Attribute Summary collapse
-
#condition ⇒ Object
readonly
Returns the value of attribute condition.
-
#daily_snapshot ⇒ Object
readonly
Returns the value of attribute daily_snapshot.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #==(another) ⇒ Object
-
#initialize(config) ⇒ TableConfig
constructor
A new instance of TableConfig.
Constructor Details
#initialize(config) ⇒ TableConfig
Returns a new instance of TableConfig.
44 45 46 47 48 |
# File 'lib/samidare/mysql.rb', line 44 def initialize(config) @name = config['name'] @daily_snapshot = config['daily_snapshot'] || false @condition = config['condition'] end |
Instance Attribute Details
#condition ⇒ Object (readonly)
Returns the value of attribute condition.
42 43 44 |
# File 'lib/samidare/mysql.rb', line 42 def condition @condition end |
#daily_snapshot ⇒ Object (readonly)
Returns the value of attribute daily_snapshot.
42 43 44 |
# File 'lib/samidare/mysql.rb', line 42 def daily_snapshot @daily_snapshot end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
42 43 44 |
# File 'lib/samidare/mysql.rb', line 42 def name @name end |
Class Method Details
.generate_table_configs(file_path = 'table.yml') ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/samidare/mysql.rb', line 50 def self.generate_table_configs(file_path = 'table.yml') configs = YAML.load_file(file_path) configs.each_with_object({}) do |(db, database_config), table_configs| table_configs[db] = database_config['tables'].map { |config| TableConfig.new(config) } table_configs end end |
Instance Method Details
#==(another) ⇒ Object
58 59 60 61 62 |
# File 'lib/samidare/mysql.rb', line 58 def ==(another) self.instance_variables.all? do |v| self.instance_variable_get(v) == another.instance_variable_get(v) end end |