Class: CareerBuilder::Resume::LazyCollection
- Inherits:
-
Object
- Object
- CareerBuilder::Resume::LazyCollection
- Defined in:
- lib/career_builder/resume/lazy_collection.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#search_options ⇒ Object
readonly
Returns the value of attribute search_options.
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(client, options) ⇒ LazyCollection
constructor
A new instance of LazyCollection.
Constructor Details
#initialize(client, options) ⇒ LazyCollection
Returns a new instance of LazyCollection.
7 8 9 10 11 |
# File 'lib/career_builder/resume/lazy_collection.rb', line 7 def initialize(client, ) @client = client @search_options = @current_page = @search_options[:page] || 1 end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/career_builder/resume/lazy_collection.rb', line 5 def client @client end |
#search_options ⇒ Object (readonly)
Returns the value of attribute search_options.
5 6 7 |
# File 'lib/career_builder/resume/lazy_collection.rb', line 5 def @search_options end |
Instance Method Details
#each ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/career_builder/resume/lazy_collection.rb', line 13 def each results = results_for @current_page loop do results.each do |resume| yield Resume.new(client, resume) end @current_page += 1 results = results_for @current_page break if results.empty? end end |