Class: AmazonPattern
- Inherits:
-
Object
- Object
- AmazonPattern
- Defined in:
- lib/patterns/amazon_pattern.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
Instance Method Summary collapse
-
#initialize ⇒ AmazonPattern
constructor
A new instance of AmazonPattern.
Constructor Details
#initialize ⇒ AmazonPattern
Returns a new instance of AmazonPattern.
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/patterns/amazon_pattern.rb', line 3 def initialize @block = lambda do |m| m.match :shipping , /Shipping & Handling/, /\$(\d+\.\d+)/ m.match :total_price, /Total for this Order/, /\$(\d+\.\d+)/ m.match_until :items, /\*{10}/ do |m| m.match :name, /\d+/, /"(.*)"/ m.match :price, /\$(\d+\.\d+)/ end end end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
2 3 4 |
# File 'lib/patterns/amazon_pattern.rb', line 2 def block @block end |