Module: Mailpot::Configuration

Extended by:
Configuration
Included in:
Configuration
Defined in:
lib/mailpot/configuration.rb

Instance Method Summary collapse

Instance Method Details

#config(&block) ⇒ Object



22
23
24
# File 'lib/mailpot/configuration.rb', line 22

def config(&block)
 instance_eval &block
end

#parameter(*names) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/mailpot/configuration.rb', line 8

def parameter(*names)
  names.each do |name|
    attr_accessor name

    # For each given symbol we generate accessor method that sets option's
    # value being called with an argument, or returns option's current value
    # when called without arguments
    define_method name do |*values|
      value = values.first
      value ? self.send("#{name}=", value) : instance_variable_get("@#{name}")
    end
  end
end