Class: ProductSpy::Host::Parser
- Inherits:
-
Object
- Object
- ProductSpy::Host::Parser
- Defined in:
- lib/product_spy/host.rb
Instance Method Summary collapse
- #get_pk(url) ⇒ Object
-
#initialize(regexp, pk_keys) ⇒ Parser
constructor
A new instance of Parser.
Constructor Details
#initialize(regexp, pk_keys) ⇒ Parser
Returns a new instance of Parser.
4 5 6 7 |
# File 'lib/product_spy/host.rb', line 4 def initialize(regexp, pk_keys) @regexp = regexp @pk_keys = pk_keys end |
Instance Method Details
#get_pk(url) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/product_spy/host.rb', line 9 def get_pk(url) if m = @regexp.match(url) return @pk_keys.map do |i| m[i] end else return nil end end |