Class: Trader::WebConverter
- Inherits:
-
SyncConverter
- Object
- Converter
- FixedConverter
- SyncConverter
- Trader::WebConverter
- Defined in:
- lib/trade-o-matic/converters/web_converter.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Attributes inherited from SyncConverter
Attributes inherited from FixedConverter
Instance Method Summary collapse
-
#initialize(_url, _path, _ttl = 30) ⇒ WebConverter
constructor
A new instance of WebConverter.
Methods inherited from SyncConverter
Methods inherited from FixedConverter
Methods inherited from Converter
Constructor Details
#initialize(_url, _path, _ttl = 30) ⇒ WebConverter
Returns a new instance of WebConverter.
7 8 9 10 11 12 13 14 15 16 17 18 |
# 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 |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/trade-o-matic/converters/web_converter.rb', line 5 def path @path end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
5 6 7 |
# File 'lib/trade-o-matic/converters/web_converter.rb', line 5 def url @url end |