Sha256: ecdb6addb90a6852a985369e19000ede45ae14c54269bdf928ac1f102f55a22e

Contents?: true

Size: 643 Bytes

Versions: 16

Compression:

Stored size: 643 Bytes

Contents

require "redd/base"

module Redd
  # A reddit thing.
  # @see http://www.reddit.com/dev/api#fullnames
  class Thing < Redd::Base
    # @!attribute [r] id
    # @return [String] The id value for the thing.
    attr_reader :id

    # @!attribute [r] kind
    # @return [String] The kind of the thing.
    attr_reader :kind

    # Check for equality.
    # @param other The other object.
    # @return [Boolean]
    def ==(other)
      other.is_a?(Redd::Thing) && full_name == other.full_name
    end

    # @return [String] The fullname of the thing.
    def fullname
      @fullname ||= (attributes[:name] || "#{kind}_#{id}")
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
redd-0.6.1 lib/redd/thing.rb
redd-0.6.0 lib/redd/thing.rb
redd-0.5.0 lib/redd/thing.rb
redd-0.4.3 lib/redd/thing.rb
redd-0.4.2 lib/redd/thing.rb
redd-0.4.1 lib/redd/thing.rb
redd-0.4.0 lib/redd/thing.rb
redd-0.3.0 lib/redd/thing.rb
redd-0.2.0 lib/redd/thing.rb
redd-0.1.6 lib/redd/thing.rb
redd-0.1.5 lib/redd/thing.rb
redd-0.1.4 lib/redd/thing.rb
redd-0.1.3 lib/redd/thing.rb
redd-0.1.2 lib/redd/thing.rb
redd-0.1.1 lib/redd/thing.rb
redd-0.1.0 lib/redd/thing.rb