Class: Replication::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/replication/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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
  @options = {}
end

Instance Attribute Details

#exceptObject

Returns the value of attribute except.



5
6
7
# File 'lib/replication/config.rb', line 5

def except
  @except
end

#model_classObject

Returns the value of attribute model_class.



5
6
7
# File 'lib/replication/config.rb', line 5

def model_class
  @model_class
end

#onlyObject

Returns the value of attribute only.



5
6
7
# File 'lib/replication/config.rb', line 5

def only
  @only
end

#optionsObject

Returns the value of attribute options.



5
6
7
# File 'lib/replication/config.rb', line 5

def options
  @options
end

#pairs_methodObject

Returns the value of attribute pairs_method.



5
6
7
# File 'lib/replication/config.rb', line 5

def pairs_method
  @pairs_method
end

#strand_classObject

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
      @options.merge!(m)
      with(m.keys)
    # else
      # type not known, ignore
    end
  end
end