Class: Adhearsion::Configuration::DrbConfiguration

Inherits:
AbstractConfiguration show all
Defined in:
lib/adhearsion/initializer/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ConfigurationEntryPoint

#add_configuration_for

Constructor Details

#initialize(overrides = {}) ⇒ DrbConfiguration

Returns a new instance of DrbConfiguration.



210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/adhearsion/initializer/configuration.rb', line 210

def initialize(overrides = {})
  self.port = overrides[:port] || self.class.default_port
  self.host = overrides[:host] || self.class.default_host
  self.acl  = overrides[:raw_acl]
  
  unless acl
    self.acl = []
    overrides[ :deny].to_a.each { |ip| acl << 'deny' << ip }
    overrides[:allow].to_a.each { |ip| acl << 'allow' << ip }
    acl.concat %w[allow 127.0.0.1] if acl.empty?
  end
end

Instance Attribute Details

#aclObject

Returns the value of attribute acl.



196
197
198
# File 'lib/adhearsion/initializer/configuration.rb', line 196

def acl
  @acl
end

#hostObject

Returns the value of attribute host.



195
196
197
# File 'lib/adhearsion/initializer/configuration.rb', line 195

def host
  @host
end

#portObject

Returns the value of attribute port.



194
195
196
# File 'lib/adhearsion/initializer/configuration.rb', line 194

def port
  @port
end

Class Method Details

.default_hostObject



205
206
207
# File 'lib/adhearsion/initializer/configuration.rb', line 205

def default_host
  'localhost'
end

.default_portObject



201
202
203
# File 'lib/adhearsion/initializer/configuration.rb', line 201

def default_port
  9050
end