Class: Surrogate::ApiComparer::SurrogateMethods

Inherits:
Struct
  • Object
show all
Defined in:
lib/surrogate/api_comparer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#surrogateObject

Returns the value of attribute surrogate

Returns:

  • (Object)

    the current value of surrogate



84
85
86
# File 'lib/surrogate/api_comparer.rb', line 84

def surrogate
  @surrogate
end

Instance Method Details

#class_api_methodsObject



111
112
113
# File 'lib/surrogate/api_comparer.rb', line 111

def class_api_methods
  Set.new surrogate.singleton_class.api_method_names
end

#class_inherited_methodsObject

should have new and clone (don’t screw up substitutability because of how we implement these)



116
117
118
# File 'lib/surrogate/api_comparer.rb', line 116

def class_inherited_methods
  Set.new surrogate.singleton_class.instance_methods - surrogate.singleton_class.instance_methods(false)
end

#class_other_methodsObject

should not have new



121
122
123
# File 'lib/surrogate/api_comparer.rb', line 121

def class_other_methods
  Set.new(surrogate.singleton_class.instance_methods false) - class_api_methods - class_inherited_methods
end

#instance_api_methodsObject



99
100
101
# File 'lib/surrogate/api_comparer.rb', line 99

def instance_api_methods
  Set.new surrogate.api_method_names
end

#instance_inherited_methodsObject



103
104
105
# File 'lib/surrogate/api_comparer.rb', line 103

def instance_inherited_methods
  Set.new surrogate.instance_methods - surrogate.instance_methods(false)
end

#instance_other_methodsObject



107
108
109
# File 'lib/surrogate/api_comparer.rb', line 107

def instance_other_methods
  Set.new(surrogate.instance_methods false) - instance_api_methods
end

#methodsObject



85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/surrogate/api_comparer.rb', line 85

def methods
  { instance: {
      api:       instance_api_methods,
      inherited: instance_inherited_methods,
      other:     instance_other_methods,
    },
    class: {
      api:       class_api_methods,
      inherited: class_inherited_methods,
      other:     class_other_methods,
    },
  }
end