Class: Octokit::Gist

Inherits:
Object
  • Object
show all
Defined in:
lib/octokit/gist.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gist) ⇒ Gist

Returns a new instance of Gist



11
12
13
14
15
16
# File 'lib/octokit/gist.rb', line 11

def initialize(gist)
  case gist
  when Fixnum, String
    @id = gist.to_s
  end
end

Instance Attribute Details

#idObject

Returns the value of attribute id



5
6
7
# File 'lib/octokit/gist.rb', line 5

def id
  @id
end

Class Method Details

.from_url(url) ⇒ Object



7
8
9
# File 'lib/octokit/gist.rb', line 7

def self.from_url(url)
  Gist.new(Addressable::URI.parse(url).path[1..-1])
end

Instance Method Details

#to_sObject



18
19
20
# File 'lib/octokit/gist.rb', line 18

def to_s
  @id
end

#urlObject



22
23
24
# File 'lib/octokit/gist.rb', line 22

def url
  "https://gist.github.com/#{@id}"
end