Class: WebCrawler::BaseConfiguration

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

Direct Known Subclasses

Configuration

Instance Method Summary collapse

Constructor Details

#initialize(options = { }) ⇒ BaseConfiguration

Returns a new instance of BaseConfiguration.



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

def initialize(options = { })
  @@options ||= { }
  @@options.merge! options
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &blk) ⇒ Object (private)



21
22
23
24
25
26
27
28
29
# File 'lib/web_crawler/configuration.rb', line 21

def method_missing(name, *args, &blk)
  if name.to_s =~ /=$/
    @@options[$`.to_sym] = args.first
  elsif @@options.key?(name)
    @@options[name]
  else
    super
  end
end

Instance Method Details

#configObject



15
16
17
# File 'lib/web_crawler/configuration.rb', line 15

def config
  self
end

#respond_to?(name) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/web_crawler/configuration.rb', line 11

def respond_to?(name)
  super || @@options.key?(name.to_sym)
end