Class: Shard::Lister
- Inherits:
-
Object
- Object
- Shard::Lister
- Defined in:
- lib/shard/lister.rb
Instance Attribute Summary collapse
-
#username ⇒ Object
readonly
# Declarations # #.
Instance Method Summary collapse
-
#gists ⇒ Object
# Instance Methods # #.
-
#initialize(username) ⇒ Lister
constructor
# Constructor # #.
- #shard_names ⇒ Object
- #shards ⇒ Object
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
#username ⇒ Object (readonly)
# Declarations #
#
11 12 13 |
# File 'lib/shard/lister.rb', line 11 def username @username end |
Instance Method Details
#gists ⇒ Object
# Instance Methods #
#
29 30 31 |
# File 'lib/shard/lister.rb', line 29 def gists @gists ||= fetch_gists.map { |gist| Gist.new(gist) } end |
#shard_names ⇒ Object
42 43 44 |
# File 'lib/shard/lister.rb', line 42 def shard_names shards.keys.sort end |
#shards ⇒ Object
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 |