Class: ShelbyArena::FundList
- Inherits:
-
Object
- Object
- ShelbyArena::FundList
- Includes:
- Enumerable
- Defined in:
- lib/api/fund_list.rb
Instance Method Summary collapse
-
#[](index) ⇒ Object
Get the specified fund.
-
#each(&block) ⇒ Object
This method is needed for Enumerable.
-
#empty? ⇒ Boolean
Checks if the list is empty.
-
#initialize(options = {}) ⇒ FundList
constructor
Constructor.
Constructor Details
#initialize(options = {}) ⇒ FundList
Constructor.
Options: :reader - (optional) The Reader to use to load the data.
16 17 18 19 |
# File 'lib/api/fund_list.rb', line 16 def initialize( = {}) reader = [:reader] || ShelbyArena::FundListReader.new() @json_data = reader.load_data['FundListResult']['Funds']['Fund'] end |
Instance Method Details
#[](index) ⇒ Object
Get the specified fund.
26 27 28 |
# File 'lib/api/fund_list.rb', line 26 def [](index) Fund.new( @json_data[index] ) unless @json_data[index].nil? end |
#each(&block) ⇒ Object
This method is needed for Enumerable.
32 33 34 |
# File 'lib/api/fund_list.rb', line 32 def each &block @json_data.each{ |fund| yield( Fund.new(fund) )} end |
#empty? ⇒ Boolean
Checks if the list is empty.
43 44 45 |
# File 'lib/api/fund_list.rb', line 43 def empty? self.count == 0 ? true : false end |