Class: Gossiper::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/gossiper/configuration.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.attribute(name, default_value = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/gossiper/configuration.rb', line 5

def attribute(name, default_value = nil)
  define_method name do
    instance_variable_get("@#{name}") || default_value
  end

  define_method "#{name}=" do |value|
    instance_variable_set("@#{name}", value.to_s)
  end
end

Instance Method Details

#authorize_with(&block) ⇒ Object



26
27
28
29
30
31
# File 'lib/gossiper/configuration.rb', line 26

def authorize_with(&block)
  if block_given?
    @authorize_with = block
  end
  @authorize_with ||= Proc.new {}
end