Sha256: 90ce0cd51b561457259ad57c9a58c73107a76de001752147beed5a9ccc356107

Contents?: true

Size: 767 Bytes

Versions: 2

Compression:

Stored size: 767 Bytes

Contents

module DebugExtras::Helpers
  module ViewHelpers
    extend ActiveSupport::Concern

    def rap(object)
      raw ap(object)
    end

    def object_dump(object, full = false)
      output = ''
      vars = object.instance_variables

      output << pretty('object class')
      output << pretty(object.class)

      output << pretty('instance variables list')
      output << pretty(vars)

      output << pretty('instance variables details')
      vars.each do |v|
        output << pretty(v)
        output << pretty(object.instance_variable_get(v))
      end

      if full
        output << pretty('methods list')
        output << pretty(object.methods)
      end

      raw output
    end

    private

    def pretty(string)
      string.ai
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
debug-extras-0.1.0 lib/debug_extras/helpers/view_helpers.rb
debug-extras-0.0.1 lib/debug_extras/helpers/view_helpers.rb