class Shard::Gist

Constants

SHARD_FILENAME
#

Declarations #

#

Public Class Methods

new(gist_hash) click to toggle source
#

Constructor #

#
# File lib/shard/gist.rb, line 21
def initialize(gist_hash)
  @gist_hash = gist_hash
end

Public Instance Methods

all_files() click to toggle source
#

Instance Methods #

#
# File lib/shard/gist.rb, line 31
def all_files
  files.values
end
description() click to toggle source
# File lib/shard/gist.rb, line 35
def description
  @gist_hash.description
end
id() click to toggle source
# File lib/shard/gist.rb, line 39
def id
  @gist_hash.id
end
name() click to toggle source
# File lib/shard/gist.rb, line 43
def name
  match = shard_file.filename.match(SHARD_FILENAME)

  match[1] || id
end
ruby_files() click to toggle source
# File lib/shard/gist.rb, line 49
def ruby_files
  files.select { |filename| filename =~ /\.rb$/ }.values
end
shard_file() click to toggle source
# File lib/shard/gist.rb, line 53
def shard_file
  files.select { |filename| filename =~ SHARD_FILENAME }.values.first
end
url() click to toggle source
# File lib/shard/gist.rb, line 57
def url
  @gist_hash.html_url
end
username() click to toggle source
# File lib/shard/gist.rb, line 61
def username
  @gist_hash.user.login
end
valid_shard?() click to toggle source
# File lib/shard/gist.rb, line 65
def valid_shard?
  ! shard_file.nil?
end

Private Instance Methods

files() click to toggle source
# File lib/shard/gist.rb, line 71
def files
  @gist_hash.files
end