class Wonde::ResultIterator
Attributes
meta[RW]
myarray[RW]
token[RW]
Public Class Methods
new(myhashostruct, token)
click to toggle source
Calls superclass method
Wonde::Endpoints::new
# File lib/resultiterator.rb, line 5 def initialize(myhashostruct, token) super p myhashostruct if ENV["debug_wonde"] self.token = token self.myarray = myhashostruct.data self.meta = myhashostruct.meta unless myhashostruct.meta.nil? end
Public Instance Methods
<<(val)
click to toggle source
# File lib/resultiterator.rb, line 13 def <<(val) @myarray << val end
each() { |val| ... }
click to toggle source
# File lib/resultiterator.rb, line 21 def each original_length = @myarray.length - 1 @myarray.each_with_index do |val,index| if index >= original_length and self.meta and self.meta.pagination.more resp = self.getUrl(self.meta.pagination.next).body nextResponse = JSON.parse(resp, object_class: OpenStruct) p nextResponse if ENV["debug_wonde"] self.meta = nextResponse.meta unless nextResponse.meta.nil? nextResponse.data.each do |element| @myarray.push(element) end original_length += nextResponse.data.count end yield val end end
length()
click to toggle source
# File lib/resultiterator.rb, line 17 def length return self.count() end