Class: ProductSpy::Configuration

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/product_spy/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



7
8
9
# File 'lib/product_spy/configuration.rb', line 7

def initialize
  @hosts = {}
end

Instance Attribute Details

#hostsObject (readonly)

Returns the value of attribute hosts.



5
6
7
# File 'lib/product_spy/configuration.rb', line 5

def hosts
  @hosts
end

Instance Method Details

#host(host, options = {}) {|host_inst| ... } ⇒ Object

Yields:

  • (host_inst)


11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/product_spy/configuration.rb', line 11

def host(host, options = {}, &block)
  host_inst = Host.new(host)
  yield host_inst
  @hosts[host.to_sym] = host_inst

  options = {
    :aliases => []
  }.merge(options)

  options[:aliases].each do |host|
    @hosts[host.to_sym] = host_inst
  end
end