Sha256: 8042cf8a5c3088cdf01b14bdba30b2cb0a7e0a8388da4f1251f30570f7b2c2ad

Contents?: true

Size: 512 Bytes

Versions: 4

Compression:

Stored size: 512 Bytes

Contents

module Findable
  module Inspection
    extend ActiveSupport::Concern

    module ClassMethods
      def inspect
        case
        when self == Findable::Base
          super
        else
          "#{self}(#{column_names.map(&:inspect).join(', ')})"
        end
      end
    end

    def inspect
      _attributes = self.class.column_names.each_with_object([]) {|name, obj|
        obj << "#{name}: #{public_send(name).inspect}"
      }.join(",\s")
      "#<#{self.class} #{_attributes}>"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
findable-0.2.2 lib/findable/inspection.rb
findable-0.2.1 lib/findable/inspection.rb
findable-0.2.0 lib/findable/inspection.rb
findable-0.1.5 lib/findable/inspection.rb