Class: RedStorm::Configurator

Inherits:
Object
  • Object
show all
Defined in:
lib/red_storm/configurator.rb

Direct Known Subclasses

SimpleTopology::ComponentDefinition

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(defaults = {}) ⇒ Configurator

Returns a new instance of Configurator.



6
7
8
9
# File 'lib/red_storm/configurator.rb', line 6

def initialize(defaults = {})
  @config = Backtype::Config.new
  defaults.each{|attribute, value| @config.put(attribute.to_s, value)}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args) ⇒ Object



15
16
17
18
# File 'lib/red_storm/configurator.rb', line 15

def method_missing(sym, *args)
  config_method = "set#{self.class.camel_case(sym)}"
  @config.send(config_method, *args)
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



4
5
6
# File 'lib/red_storm/configurator.rb', line 4

def config
  @config
end

Instance Method Details

#set(attribute, value) ⇒ Object



11
12
13
# File 'lib/red_storm/configurator.rb', line 11

def set(attribute, value)
  @config.put(attribute.to_s, value)
end