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.



242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/adhearsion/initializer/configuration.rb', line 242

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.



228
229
230
# File 'lib/adhearsion/initializer/configuration.rb', line 228

def acl
  @acl
end

#hostObject

Returns the value of attribute host.



227
228
229
# File 'lib/adhearsion/initializer/configuration.rb', line 227

def host
  @host
end

#portObject

Returns the value of attribute port.



226
227
228
# File 'lib/adhearsion/initializer/configuration.rb', line 226

def port
  @port
end

Class Method Details

.default_hostObject



237
238
239
# File 'lib/adhearsion/initializer/configuration.rb', line 237

def default_host
  'localhost'
end

.default_portObject



233
234
235
# File 'lib/adhearsion/initializer/configuration.rb', line 233

def default_port
  9050
end