class Reponaut::GitHub::Repository

Public Class Methods

new(service, data) click to toggle source
# File lib/reponaut/github.rb, line 78
def initialize(service, data)
  @service = service
  @data = data
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/reponaut/github.rb, line 96
def <=>(other)
  name.downcase <=> other.name.downcase
end
method_missing(symbol, *args) click to toggle source
Calls superclass method
# File lib/reponaut/github.rb, line 100
def method_missing(symbol, *args)
  if @data.include?(symbol.to_s)
    @data[symbol.to_s]
  else
    if symbol.to_s.end_with?('?')
      bool_sym = symbol.to_s.slice(0, symbol.to_s.length-1)
      if @data.include?(bool_sym) && @data[bool_sym].bool?
        @data[bool_sym]
      else
        super
      end
    else
      super
    end
  end
end
source?() click to toggle source
# File lib/reponaut/github.rb, line 83
def source?
  !fork?
end
to_s() click to toggle source
# File lib/reponaut/github.rb, line 92
def to_s
  full_name
end
upstream() click to toggle source
# File lib/reponaut/github.rb, line 87
def upstream
  return nil unless fork?
  repo_data['parent']['full_name']
end

Private Instance Methods

mock_repo_data() click to toggle source
# File lib/reponaut/github.rb, line 123
def mock_repo_data
  path = File.expand_path("../../../spec/fixtures/repos/#{full_name}.json", __FILE__)
  raw_data = IO.read(path)
  JSON.parse(raw_data)
end
real_repo_data() click to toggle source
# File lib/reponaut/github.rb, line 119
def real_repo_data
  @service.get("/repos/#{full_name}")
end