class Trader::WebConverter

Attributes

path[R]
url[R]

Public Class Methods

new(_url, _path, _ttl=30) click to toggle source
Calls superclass method Trader::SyncConverter::new
# File lib/trade-o-matic/converters/web_converter.rb, line 7
def initialize(_url, _path, _ttl=30)
  @url = _url
  @path = _path

  super(_ttl) do
    pincers = Pincers.for_chenso
    pincers.goto _url
    el = pincers.search(_path).first
    raise "No element found at #{_path}" if el.nil?
    Standard.amount el.text.gsub(/[^\d\s\.\,]+/,'').strip
  end
end