Class: Scruber::Helpers::UserAgentRotator::UserAgent
- Defined in:
- lib/scruber/helpers/user_agent_rotator.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#tags ⇒ Object
Returns the value of attribute tags.
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(name, options = {}) ⇒ UserAgent
constructor
A new instance of UserAgent.
Constructor Details
#initialize(name, options = {}) ⇒ UserAgent
Returns a new instance of UserAgent.
8 9 10 11 12 13 14 15 16 |
# File 'lib/scruber/helpers/user_agent_rotator.rb', line 8 def initialize(name, ={}) @name = name raise Scruber::ArgumentError.new("You need to specify name") if @name.blank? @tags = .fetch(:tags){ [] } || [] if !@tags.is_a?(Array) @tags = [@tags] end @tags = @tags.compact.map(&:to_sym) end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/scruber/helpers/user_agent_rotator.rb', line 6 def name @name end |
#tags ⇒ Object
Returns the value of attribute tags.
6 7 8 |
# File 'lib/scruber/helpers/user_agent_rotator.rb', line 6 def @tags end |
Instance Method Details
#id ⇒ Object
18 19 20 |
# File 'lib/scruber/helpers/user_agent_rotator.rb', line 18 def id @name end |