Class: SchwabRb::DataObjects::MarketMovers
- Inherits:
-
Object
- Object
- SchwabRb::DataObjects::MarketMovers
- Includes:
- Enumerable
- Defined in:
- lib/schwab_rb/data_objects/market_movers.rb
Instance Attribute Summary collapse
-
#movers ⇒ Object
readonly
Returns the value of attribute movers.
Instance Method Summary collapse
- #count ⇒ Object
- #each(&block) ⇒ Object
- #find_by_symbol(symbol) ⇒ Object
-
#initialize(movers) ⇒ MarketMovers
constructor
A new instance of MarketMovers.
- #symbols ⇒ Object
- #to_a ⇒ Object
- #top(num = 5) ⇒ Object
Constructor Details
#initialize(movers) ⇒ MarketMovers
Returns a new instance of MarketMovers.
17 18 19 |
# File 'lib/schwab_rb/data_objects/market_movers.rb', line 17 def initialize(movers) @movers = movers end |
Instance Attribute Details
#movers ⇒ Object (readonly)
Returns the value of attribute movers.
15 16 17 |
# File 'lib/schwab_rb/data_objects/market_movers.rb', line 15 def movers @movers end |
Instance Method Details
#count ⇒ Object
21 22 23 |
# File 'lib/schwab_rb/data_objects/market_movers.rb', line 21 def count @movers.size end |
#each(&block) ⇒ Object
37 38 39 |
# File 'lib/schwab_rb/data_objects/market_movers.rb', line 37 def each(&block) @movers.each(&block) end |
#find_by_symbol(symbol) ⇒ Object
29 30 31 |
# File 'lib/schwab_rb/data_objects/market_movers.rb', line 29 def find_by_symbol(symbol) @movers.find { |mover| mover.symbol == symbol } end |
#symbols ⇒ Object
25 26 27 |
# File 'lib/schwab_rb/data_objects/market_movers.rb', line 25 def symbols @movers.map(&:symbol) end |
#to_a ⇒ Object
41 42 43 |
# File 'lib/schwab_rb/data_objects/market_movers.rb', line 41 def to_a @movers end |
#top(num = 5) ⇒ Object
33 34 35 |
# File 'lib/schwab_rb/data_objects/market_movers.rb', line 33 def top(num = 5) @movers.first(num) end |