Class: Dub::FunctionGroup

Inherits:
Array
  • Object
show all
Defined in:
lib/dub/function_group.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent, gen = nil) ⇒ FunctionGroup

Returns a new instance of FunctionGroup.



3
4
5
# File 'lib/dub/function_group.rb', line 3

def initialize(parent, gen = nil)
  @parent, @gen = parent, gen
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object (private)



67
68
69
# File 'lib/dub/function_group.rb', line 67

def method_missing(method, *args)
  first.send(method, *args)
end

Instance Method Details

#<=>(other) ⇒ Object



62
63
64
# File 'lib/dub/function_group.rb', line 62

def <=>(other)
  name <=> other.name
end

#bind(generator) ⇒ Object



7
8
9
# File 'lib/dub/function_group.rb', line 7

def bind(generator)
  self.gen = generator.function_generator
end

#compactObject



50
51
52
53
54
55
56
# File 'lib/dub/function_group.rb', line 50

def compact
  list = self.class.new(@parent, @gen)
  super.each do |e|
    list << e
  end
  list
end

#gen=(generator) ⇒ Object



15
16
17
18
# File 'lib/dub/function_group.rb', line 15

def gen=(generator)
  @gen = generator
  @gen_members = nil
end

#generatorObject Also known as: gen



11
12
13
# File 'lib/dub/function_group.rb', line 11

def generator
  @gen || (@parent && @parent.function_generator)
end

#map(&block) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/dub/function_group.rb', line 42

def map(&block)
  list = self.class.new(@parent, @gen)
  super(&block).each do |e|
    list << e
  end
  list
end

#membersObject



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/dub/function_group.rb', line 22

def members
  if self.generator
    if @parent.generator
      @gen_members ||= @parent.generator.members_list(self)
    else
      @gen_members ||= generator.namespace_generator.members_list(self)
    end
  else
    self
  end
end

#method_name(overloaded_index = nil) ⇒ Object



38
39
40
# File 'lib/dub/function_group.rb', line 38

def method_name(overloaded_index = nil)
  first.method_name(overloaded_index)
end

#overloaded_indexObject



58
59
60
# File 'lib/dub/function_group.rb', line 58

def overloaded_index
  nil
end

#to_sObject



34
35
36
# File 'lib/dub/function_group.rb', line 34

def to_s
  generator.group(self)
end