Module: Surrogate::InstanceMethods

Defined in:
lib/surrogate/endower.rb

Overview

Use module so the method is inherited. This allows proper matching (e.g. other object will inherit inspect from Object)

Instance Method Summary collapse

Instance Method Details

#inspectObject



182
183
184
185
186
187
188
# File 'lib/surrogate/endower.rb', line 182

def inspect
  methods = SurrogateClassReflector.new(self.class).methods[:instance][:api].sort.take(4)
  methods[-1] = '...' if methods.size == 4
  methods << 'no api' if methods.empty?
  class_name = self.class.name || 'AnonymousSurrogate'
  "#<#{class_name}: #{methods.join ' '}>"
end