Class: Reponaut::GitHub::Repository
Instance Method Summary
collapse
Constructor Details
#initialize(service, data) ⇒ Repository
Returns a new instance of Repository.
78
79
80
81
|
# File 'lib/reponaut/github.rb', line 78
def initialize(service, data)
@service = service
@data = data
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(symbol, *args) ⇒ Object
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
# 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
|
Instance Method Details
#<=>(other) ⇒ Object
96
97
98
|
# File 'lib/reponaut/github.rb', line 96
def <=>(other)
name.downcase <=> other.name.downcase
end
|
#source? ⇒ Boolean
83
84
85
|
# File 'lib/reponaut/github.rb', line 83
def source?
!fork?
end
|
92
93
94
|
# File 'lib/reponaut/github.rb', line 92
def to_s
full_name
end
|
87
88
89
90
|
# File 'lib/reponaut/github.rb', line 87
def upstream
return nil unless fork?
repo_data['parent']['full_name']
end
|