Sha256: 519c64566bd3788a54391f2d690e206f41e6f5443fa12bd563dd489d24c570ec
Contents?: true
Size: 717 Bytes
Versions: 3
Compression:
Stored size: 717 Bytes
Contents
# frozen_string_literal: true require_relative 'basic_model' module Redd module Models # A backward-expading listing of items. # @see Stream class Listing < BasicModel include Enumerable # @return [Array<Comment, Submission, PrivateMessage>] an array representation of self def to_ary get_attribute(:children) end %i([] each empty? first last).each do |method_name| define_method(method_name) do |*args, &block| get_attribute(:children).public_send(method_name, *args, &block) end end private def after_initialize @attributes.fetch(:children).map! { |el| @client.unmarshal(el) } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
redd-0.8.4 | lib/redd/models/listing.rb |
redd-0.8.3 | lib/redd/models/listing.rb |
redd-0.8.2 | lib/redd/models/listing.rb |