Module Cabin::Inspectable
In: lib/cabin/inspectable.rb
lib/cabin/inspectable.rb

Methods

inspect   inspect  

Public Instance methods

Provide a saner inspect method that‘s easier to configure.

By default, will inspect all instance variables. You can tune this by setting @inspectables to an array of ivar symbols, like:

    [ :@hello, :@world ]

    class Foo
      include Cabin::Inspectable

      def initialize
        @inspectables = [:@foo, :@bar]
        @foo = 123
        @bar = "hello"
        @baz = "ok"
      end
    end

    foo = Foo.new
    foo.inspect == '<Foo(1) @foo=123 @bar="hello" >'

Provide a saner inspect method that‘s easier to configure.

By default, will inspect all instance variables. You can tune this by setting @inspectables to an array of ivar symbols, like:

    [ :@hello, :@world ]

    class Foo
      include Cabin::Inspectable

      def initialize
        @inspectables = [:@foo, :@bar]
        @foo = 123
        @bar = "hello"
        @baz = "ok"
      end
    end

    foo = Foo.new
    foo.inspect == '<Foo(1) @foo=123 @bar="hello" >'

[Validate]