Class: Octokit::Gist
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/octokit/gist.rb |
Overview
Class to parse and create Gist
URLs
Class Method Summary
-
.from_url(url)
Instantiate
Gist
object fromGist
URL @ return [Gist]. - .new(gist) ⇒ Gist constructor
Instance Attribute Summary
-
#id
rw
!@attribute id.
Instance Method Summary
-
#to_s ⇒ String
Gist
ID. -
#url ⇒ String
Gist
URL.
Constructor Details
.new(gist) ⇒ Gist
# File 'lib/octokit/gist.rb', line 16
def initialize(gist) case gist when Integer, String @id = gist.to_s end end
Class Method Details
.from_url(url)
Instantiate Gist
object from Gist
URL
@ return [Gist]
Instance Attribute Details
#id (rw)
!@attribute id @return [String] Gist ID
# File 'lib/octokit/gist.rb', line 8
attr_accessor :id
Instance Method Details
#to_s ⇒ String
Gist
ID
# File 'lib/octokit/gist.rb', line 25
def to_s @id end
#url ⇒ String
Gist
URL
# File 'lib/octokit/gist.rb', line 31
def url "https://gist.github.com/#{@id}" end