Class: Forex::Trader
- Inherits:
-
Object
- Object
- Forex::Trader
- Defined in:
- lib/forex/trader.rb
Class Attribute Summary collapse
-
.all ⇒ Object
Returns the value of attribute all.
Instance Attribute Summary collapse
-
#base_currency ⇒ Object
Returns the value of attribute base_currency.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#name ⇒ Object
Returns the value of attribute name.
-
#rates ⇒ Object
Returns the value of attribute rates.
-
#rates_parser ⇒ Object
Returns the value of attribute rates_parser.
-
#short_name ⇒ Object
Returns the value of attribute short_name.
-
#twitter_handle ⇒ Object
Returns the value of attribute twitter_handle.
Class Method Summary collapse
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize(short_name) ⇒ Trader
constructor
A new instance of Trader.
Constructor Details
#initialize(short_name) ⇒ Trader
Returns a new instance of Trader.
29 30 31 |
# File 'lib/forex/trader.rb', line 29 def initialize(short_name) @short_name = short_name end |
Class Attribute Details
.all ⇒ Object
Returns the value of attribute all.
14 15 16 |
# File 'lib/forex/trader.rb', line 14 def all @all end |
Instance Attribute Details
#base_currency ⇒ Object
Returns the value of attribute base_currency.
5 6 7 |
# File 'lib/forex/trader.rb', line 5 def base_currency @base_currency end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
5 6 7 |
# File 'lib/forex/trader.rb', line 5 def endpoint @endpoint end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/forex/trader.rb', line 5 def name @name end |
#rates ⇒ Object
Returns the value of attribute rates.
5 6 7 |
# File 'lib/forex/trader.rb', line 5 def rates @rates end |
#rates_parser ⇒ Object
Returns the value of attribute rates_parser.
5 6 7 |
# File 'lib/forex/trader.rb', line 5 def rates_parser @rates_parser end |
#short_name ⇒ Object
Returns the value of attribute short_name.
5 6 7 |
# File 'lib/forex/trader.rb', line 5 def short_name @short_name end |
#twitter_handle ⇒ Object
Returns the value of attribute twitter_handle.
5 6 7 |
# File 'lib/forex/trader.rb', line 5 def twitter_handle @twitter_handle end |
Class Method Details
.define(short_name) {|t| ... } ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/forex/trader.rb', line 16 def define(short_name) raise CannotRedefineTrader, short_name if all[short_name] t = Forex::Trader.new(short_name) yield t if block_given? @all[short_name] = t end |
.reset ⇒ Object
24 25 26 |
# File 'lib/forex/trader.rb', line 24 def reset @all = Hash.new end |
Instance Method Details
#fetch ⇒ Object
33 34 35 |
# File 'lib/forex/trader.rb', line 33 def fetch @rates = rates_parser.(doc) end |