class Octokit::Gist

Class to parse and create Gist URLs

Attributes

id[RW]

!@attribute id

@return [String] Gist ID

Public Class Methods

from_url(url) click to toggle source

Instantiate {Gist} object from Gist URL @ return [Gist]

# File lib/octokit/gist.rb, line 12
def self.from_url(url)
  Gist.new(URI.parse(url).path[1..-1])
end
new(gist) click to toggle source
# File lib/octokit/gist.rb, line 16
def initialize(gist)
  case gist
  when Integer, String
    @id = gist.to_s
  end
end

Public Instance Methods

to_s() click to toggle source

Gist ID @return [String]

# File lib/octokit/gist.rb, line 25
def to_s
  @id
end
url() click to toggle source

Gist URL @return [String]

# File lib/octokit/gist.rb, line 31
def url
  "https://gist.github.com/#{@id}"
end