Class: Gitosis::Group

Inherits:
Object
  • Object
show all
Defined in:
lib/gitosis_easy_conf/groups.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Group

Returns a new instance of Group.



22
23
24
25
# File 'lib/gitosis_easy_conf/groups.rb', line 22

def initialize(&block)
  @groups = {}
  instance_eval(&block)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



27
28
29
30
31
32
33
34
# File 'lib/gitosis_easy_conf/groups.rb', line 27

def method_missing(method, *args, &block)
  if args.length > 0
    @groups[method.to_sym] = args
  else
    raise UnknownGroup, "Unkown group '#{method}'" unless @groups[method]
    @groups[method].uniq.join(" ")
  end
end

Instance Method Details

#[](name) ⇒ Object



46
47
48
# File 'lib/gitosis_easy_conf/groups.rb', line 46

def [](name)
  send(name)
end

#denormalizeObject



36
37
38
39
40
41
42
43
44
# File 'lib/gitosis_easy_conf/groups.rb', line 36

def denormalize
  @groups.keys.each do |key|
    @groups[key] = @groups[key].collect do |member|
      @_refs = []
      denormalize_member(member)
    end.flatten
  end
  self
end