Class: Scruber::Helpers::UserAgentRotator::Configuration

Inherits:
Object
  • Object
show all
Includes:
Core::Extensions::Loop::CoreMethods
Defined in:
lib/scruber/helpers/user_agent_rotator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Core::Extensions::Loop::CoreMethods

#add_dictionary, #loop

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



28
29
30
31
# File 'lib/scruber/helpers/user_agent_rotator.rb', line 28

def initialize
  @tags = :all
  @user_agents = []
end

Instance Attribute Details

#tagsObject (readonly)

Returns the value of attribute tags.



26
27
28
# File 'lib/scruber/helpers/user_agent_rotator.rb', line 26

def tags
  @tags
end

#user_agentsObject (readonly)

Returns the value of attribute user_agents.



26
27
28
# File 'lib/scruber/helpers/user_agent_rotator.rb', line 26

def user_agents
  @user_agents
end

Instance Method Details

#add(name, options = {}) ⇒ Object



41
42
43
44
# File 'lib/scruber/helpers/user_agent_rotator.rb', line 41

def add(name, options={})
  ua = UserAgent.new(name, options)
  @user_agents.push ua
end

#cleanObject



37
38
39
# File 'lib/scruber/helpers/user_agent_rotator.rb', line 37

def clean
  @user_agents = []
end

#configure(&block) ⇒ Object



33
34
35
# File 'lib/scruber/helpers/user_agent_rotator.rb', line 33

def configure(&block)
  instance_eval &block
end

#set_filter(tags) ⇒ Object



46
47
48
# File 'lib/scruber/helpers/user_agent_rotator.rb', line 46

def set_filter(tags)
  @tags = tags
end