class Shard::Lister

Attributes

username[R]
#

Declarations #

#

Public Class Methods

new(username) click to toggle source
#

Constructor #

#
# File lib/shard/lister.rb, line 19
def initialize(username)
  @username = username
end

Public Instance Methods

gists() click to toggle source
#

Instance Methods #

#
# File lib/shard/lister.rb, line 29
def gists
  @gists ||= fetch_gists.map { |gist| Gist.new(gist) }
end
shard_names() click to toggle source
# File lib/shard/lister.rb, line 42
def shard_names
  shards.keys.sort
end
shards() click to toggle source
# File lib/shard/lister.rb, line 33
def shards
  @shards ||= Hash.new.tap do |hash|
    valid = gists.select { |gist| gist.valid_shard? }
    valid.each do |shard|
      hash[shard.name] = shard
    end
  end
end

Private Instance Methods

fetch_gists() click to toggle source
# File lib/shard/lister.rb, line 48
def fetch_gists
  Shard.api.gists username
end
gist_by_id(id) click to toggle source
# File lib/shard/lister.rb, line 52
def gist_by_id(id)
  gists.detect { |gist| gist.id == id.to_s }
end