Class: SchwabRb::DataObjects::MarketMovers

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/schwab_rb/data_objects/market_movers.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#moversObject (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

#countObject



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

#symbolsObject



25
26
27
# File 'lib/schwab_rb/data_objects/market_movers.rb', line 25

def symbols
  @movers.map(&:symbol)
end

#to_aObject



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