Module: RKS::Support::Configurable::ClassMethods

Defined in:
lib/rks/support/configurable.rb

Instance Method Summary collapse

Instance Method Details

#configObject



9
10
11
# File 'lib/rks/support/configurable.rb', line 9

def config
  @config ||= OpenStruct.new
end

#config_attr(configs) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/rks/support/configurable.rb', line 13

def config_attr(configs)
  if configs.class.to_s == "Hash"
    configs.each { |k,v| config.send("#{k.to_s}=", v) }
  else
    raise InvalidConfugurationName, "#{configs.class.to_s} is not allowed to be a configuration"
  end
end

#configure {|config| ... } ⇒ Object

Yields:



21
22
23
# File 'lib/rks/support/configurable.rb', line 21

def configure
  yield config
end