Class: Scruber::Helpers::UserAgentRotator::Configuration
- Includes:
- Core::Extensions::Loop::CoreMethods
- Defined in:
- lib/scruber/helpers/user_agent_rotator.rb
Instance Attribute Summary collapse
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#user_agents ⇒ Object
readonly
Returns the value of attribute user_agents.
Instance Method Summary collapse
- #add(name, options = {}) ⇒ Object
- #clean ⇒ Object
- #configure(&block) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #set_filter(tags) ⇒ Object
Methods included from Core::Extensions::Loop::CoreMethods
Constructor Details
#initialize ⇒ Configuration
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
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
26 27 28 |
# File 'lib/scruber/helpers/user_agent_rotator.rb', line 26 def @tags end |
#user_agents ⇒ Object (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, ={}) ua = UserAgent.new(name, ) @user_agents.push ua end |
#clean ⇒ Object
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 = end |