class Github::RepoList
Public Class Methods
new()
click to toggle source
# File lib/knife-github/repo.rb, line 106 def initialize # Instance variables @repos = Array.new end
Public Instance Methods
[](key)
click to toggle source
# File lib/knife-github/repo.rb, line 150 def [](key) return @repos[key] if key.kind_of?(Integer) return @repos.find { |aRepo| aRepo.name == key } nil end
count()
click to toggle source
# File lib/knife-github/repo.rb, line 129 def count @repos.count end
delete(key)
click to toggle source
# File lib/knife-github/repo.rb, line 133 def delete(key) @repos.delete(self.find(key)) self end
find(key)
click to toggle source
# File lib/knife-github/repo.rb, line 142 def find(key) @repos.find { |aRepo| aRepo.name == key } end
find_index(key)
click to toggle source
# File lib/knife-github/repo.rb, line 146 def find_index(key) @repos.find_index { |aRepo| aRepo.name == key } end
last()
click to toggle source
# File lib/knife-github/repo.rb, line 138 def last @repos.last end
pop()
click to toggle source
# File lib/knife-github/repo.rb, line 125 def pop @repos.pop end
push(aRepo)
click to toggle source
# File lib/knife-github/repo.rb, line 111 def push(aRepo) pos = self.find_index(aRepo.name) if pos @repos[pos] = aRepo else @repos.push(aRepo) end self end
shift()
click to toggle source
# File lib/knife-github/repo.rb, line 121 def shift @repos.shift end
to_pretty_json()
click to toggle source
# File lib/knife-github/repo.rb, line 156 def to_pretty_json json = [] @repos.each do |repo| json << repo.to_hash end JSON.pretty_generate(json) end