Class: Replication::Config
- Inherits:
-
Object
- Object
- Replication::Config
- Defined in:
- lib/replication/config.rb
Instance Attribute Summary collapse
-
#except ⇒ Object
Returns the value of attribute except.
-
#model_class ⇒ Object
Returns the value of attribute model_class.
-
#only ⇒ Object
Returns the value of attribute only.
-
#options ⇒ Object
Returns the value of attribute options.
-
#pairs_method ⇒ Object
Returns the value of attribute pairs_method.
-
#strand_class ⇒ Object
Returns the value of attribute strand_class.
Instance Method Summary collapse
-
#initialize(model_class) ⇒ Config
constructor
A new instance of Config.
- #set(params) ⇒ Object
- #with(modules) ⇒ Object
Constructor Details
#initialize(model_class) ⇒ Config
Returns a new instance of Config.
7 8 9 10 |
# File 'lib/replication/config.rb', line 7 def initialize(model_class) @model_class = model_class = {} end |
Instance Attribute Details
#except ⇒ Object
Returns the value of attribute except.
5 6 7 |
# File 'lib/replication/config.rb', line 5 def except @except end |
#model_class ⇒ Object
Returns the value of attribute model_class.
5 6 7 |
# File 'lib/replication/config.rb', line 5 def model_class @model_class end |
#only ⇒ Object
Returns the value of attribute only.
5 6 7 |
# File 'lib/replication/config.rb', line 5 def only @only end |
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/replication/config.rb', line 5 def end |
#pairs_method ⇒ Object
Returns the value of attribute pairs_method.
5 6 7 |
# File 'lib/replication/config.rb', line 5 def pairs_method @pairs_method end |
#strand_class ⇒ Object
Returns the value of attribute strand_class.
5 6 7 |
# File 'lib/replication/config.rb', line 5 def strand_class @strand_class end |
Instance Method Details
#set(params) ⇒ Object
26 27 28 |
# File 'lib/replication/config.rb', line 26 def set(params) params and params.each {|name, value| self.send "#{name}=", value} end |
#with(modules) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/replication/config.rb', line 12 def with(modules) modules.each do |m| case m when Symbol model_class.send :include, Replication::Modules.const_get(m.to_s.classify) when Hash .merge!(m) with(m.keys) # else # type not known, ignore end end end |