Class: Shard::Lister

Inherits:
Object
  • Object
show all
Defined in:
lib/shard/lister.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username) ⇒ Lister

# Constructor #

#


19
20
21
# File 'lib/shard/lister.rb', line 19

def initialize(username)
  @username = username
end

Instance Attribute Details

#usernameObject (readonly)

# Declarations #

#


11
12
13
# File 'lib/shard/lister.rb', line 11

def username
  @username
end

Instance Method Details

#gistsObject

# Instance Methods #

#


29
30
31
# File 'lib/shard/lister.rb', line 29

def gists
  @gists ||= fetch_gists.map { |gist| Gist.new(gist) }
end

#shard_namesObject



42
43
44
# File 'lib/shard/lister.rb', line 42

def shard_names
  shards.keys.sort
end

#shardsObject



33
34
35
36
37
38
39
40
# 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