module MiniObject::RemarkableInspect::ClassMethods

Public Instance Methods

formatted_name() click to toggle source
# File lib/mini_object/remarkable_inspect.rb, line 41
def formatted_name
  first_ancestor_name = ancestors.map(&:name).compact.first
  name || "#{first_ancestor_name}:0x#{'%x' % (object_id << 1)}"
end
inspect() click to toggle source
# File lib/mini_object/remarkable_inspect.rb, line 24
def inspect
  "#{formatted_name}( #{remarkable_methods.join(", ")} )"
end
remarkable_methods() click to toggle source
# File lib/mini_object/remarkable_inspect.rb, line 28
def remarkable_methods
  (self.instance_methods - Box.instance_methods).sort.map(&:to_s).tap do |mm|
    # Substittues [my_method, my_method=] by [my_method/=]
    mm.grep(/\=$/).each do |setter|
      getter = setter.gsub /\=$/, ''
      if mm.include? getter
        mm.delete setter
        mm[mm.find_index(getter)] = setter.gsub /\=$/, '/='
      end
    end
  end
end