Sha256: 387c859f7363c2fafb6a2efc1aa427dfd06b9521b3a87a3370fcff1f7b5bdb6c
Contents?: true
Size: 858 Bytes
Versions: 10
Compression:
Stored size: 858 Bytes
Contents
module EventbriteSDK # An Empty resource listing, returned on ORM calls from new resources class BlankResourceList extend Forwardable include Enumerable def_delegators :@objects, :[], :concat, :each, :empty?, :to_ary def initialize(key: nil) @key = key @objects = [] end %i( next_page prev_page retrieve ).each do |method| define_method(method) { self } end def concat(other) other.concat(to_ary) end def page(_num) self end def with_expansion(*_args) self end def to_json(opts = {}) { @key => [] }.to_json(opts) end # Blank lists need to respond to the pagination helpers. def object_count 0 end %i(page_count page_number page_size).each do |name| define_method(name) { 1 } end end end
Version data entries
10 entries across 10 versions & 1 rubygems