class NeonRAW::Objects::MoreComments

The MoreComments object.

Public Class Methods

new(client, data) click to toggle source
# File lib/NeonRAW/objects/morecomments.rb, line 7
def initialize(client, data)
  @client = client
  data.each do |key, value|
    # for consistency, empty strings/arrays/hashes are set to nil
    # because most of the keys returned by Reddit are nil when they
    # don't have a value, besides a few
    value = nil if ['', [], {}].include?(value)
    instance_variable_set(:"@#{key}", value)
    self.class.send(:attr_reader, key)
  end
end

Public Instance Methods

comment?() click to toggle source

Returns whether or not the object is a Comment object. @!method comment? @return [Boolean] Returns false.

# File lib/NeonRAW/objects/morecomments.rb, line 29
def comment?
  false
end
expand() click to toggle source

Expands the MoreComments object. @!method expand @return [NeonRAW::Objects::Listing] Returns a listing with all of the

comments that were expanded.
# File lib/NeonRAW/objects/morecomments.rb, line 37
def expand
  return [] if children.nil?
  # /api/morechildren is buggy shit. This is better.
  @client.info(name: children.map { |the_id| 't1_' + the_id }.join(','))
end
morecomments?() click to toggle source

Returns whether or not the object is a MoreComments object. @!method morecomments? @return [Boolean] Returns true.

# File lib/NeonRAW/objects/morecomments.rb, line 22
def morecomments?
  true
end