class Gitosis::Forker
Public Class Methods
new(&block)
click to toggle source
# File lib/gitosis_easy_conf/forkers.rb, line 11 def initialize(&block) @forkers = {} instance_eval(&block) end
Public Instance Methods
[](name)
click to toggle source
# File lib/gitosis_easy_conf/forkers.rb, line 37 def [](name) send(name.to_sym) end
all()
click to toggle source
# File lib/gitosis_easy_conf/forkers.rb, line 41 def all @forkers.keys end
method_missing(method, *args, &block)
click to toggle source
# File lib/gitosis_easy_conf/forkers.rb, line 16 def method_missing(method, *args, &block) if args.length > 0 if @forkers.values.include?(args.first.to_s) raise(SamePublicKeyForForkers, "Key '#{args.first}' used by '#{method}' "+ "and #{@forkers.invert[args.first.to_s]}'") end if @forkers.keys.include?(method) raise(ForkerAlreadyDefined, "Forker '#{method}' already defined with key: " + "#{@forkers[method]}") end @forkers[method] = args.first.to_s else raise(Gitosis::UnknownForker, "Forker '#{method}' Not Found") unless @forkers.keys.include?(method) @forkers[method] end end