Module: Danger::Helpers::ArraySubclass

Includes:
Comparable
Included in:
FileList
Defined in:
lib/danger/helpers/array_subclass.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



16
17
18
19
20
# File 'lib/danger/helpers/array_subclass.rb', line 16

def method_missing(name, *args, &block)
  super unless __array__.respond_to?(name)

  respond_to_method(name, *args, &block)
end

Instance Method Details

#<=>(other) ⇒ Object



34
35
36
37
38
# File 'lib/danger/helpers/array_subclass.rb', line 34

def <=>(other)
  return unless other.kind_of?(self.class)

  __array__ <=> other.instance_variable_get(:@__array__)
end

#initialize(array) ⇒ Object



6
7
8
# File 'lib/danger/helpers/array_subclass.rb', line 6

def initialize(array)
  @__array__ = array
end

#kind_of?(compare_class) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
# File 'lib/danger/helpers/array_subclass.rb', line 10

def kind_of?(compare_class)
  return true if compare_class == self.class

  dummy.kind_of?(compare_class)
end

#respond_to_missing?(name, include_all) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/danger/helpers/array_subclass.rb', line 22

def respond_to_missing?(name, include_all)
  __array__.respond_to?(name, include_all) || super
end

#to_aObject



26
27
28
# File 'lib/danger/helpers/array_subclass.rb', line 26

def to_a
  __array__
end

#to_aryObject



30
31
32
# File 'lib/danger/helpers/array_subclass.rb', line 30

def to_ary
  __array__
end