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.
31 32 33 |
# File 'lib/forex/trader.rb', line 31 def initialize(short_name) @short_name = short_name end |
Class Attribute Details
.all ⇒ Object
Returns the value of attribute all.
16 17 18 |
# File 'lib/forex/trader.rb', line 16 def all @all end |
Instance Attribute Details
#base_currency ⇒ Object
Returns the value of attribute base_currency.
7 8 9 |
# File 'lib/forex/trader.rb', line 7 def base_currency @base_currency end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
7 8 9 |
# File 'lib/forex/trader.rb', line 7 def endpoint @endpoint end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/forex/trader.rb', line 7 def name @name end |
#rates ⇒ Object
Returns the value of attribute rates.
7 8 9 |
# File 'lib/forex/trader.rb', line 7 def rates @rates end |
#rates_parser ⇒ Object
Returns the value of attribute rates_parser.
7 8 9 |
# File 'lib/forex/trader.rb', line 7 def rates_parser @rates_parser end |
#short_name ⇒ Object
Returns the value of attribute short_name.
7 8 9 |
# File 'lib/forex/trader.rb', line 7 def short_name @short_name end |
#twitter_handle ⇒ Object
Returns the value of attribute twitter_handle.
7 8 9 |
# File 'lib/forex/trader.rb', line 7 def twitter_handle @twitter_handle end |
Class Method Details
.define(short_name) {|t| ... } ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/forex/trader.rb', line 18 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
26 27 28 |
# File 'lib/forex/trader.rb', line 26 def reset @all = Hash.new end |
Instance Method Details
#fetch ⇒ Object
35 36 37 |
# File 'lib/forex/trader.rb', line 35 def fetch @rates = rates_parser.(doc) end |