Sha256: 8e0e3a23c6243e90eb6186732b0666d8b44e203bbb630c028ee39f595a209550

Contents?: true

Size: 533 Bytes

Versions: 18

Compression:

Stored size: 533 Bytes

Contents

require 'active_support'

module Inspect
  extend ActiveSupport::Concern

  def inspect
    [
      "#{to_s.match('LHS::Data') ? 'Data of ' : nil}#{self.class}##{object_id}",
      pretty_raw
    ].compact.join("\n")
  end

  private

  def pretty_raw
    return if _raw.blank?
    if _raw.is_a?(Array)
      _raw
    else
      _raw.to_a.map do |key, value|
        ":#{key} => " +
          if value.is_a? String
            "\"#{value}\""
          else
            value.to_s
          end
      end
    end.join("\n")
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
lhs-7.0.3 lib/lhs/concerns/inspect.rb
lhs-7.0.2 lib/lhs/concerns/inspect.rb
lhs-7.0.1 lib/lhs/concerns/inspect.rb
lhs-7.0.0 lib/lhs/concerns/inspect.rb
lhs-6.8.2 lib/lhs/concerns/inspect.rb
lhs-6.8.1 lib/lhs/concerns/inspect.rb
lhs-6.8.0 lib/lhs/concerns/inspect.rb
lhs-6.7.2 lib/lhs/concerns/inspect.rb
lhs-6.7.1 lib/lhs/concerns/inspect.rb
lhs-6.7.0 lib/lhs/concerns/inspect.rb
lhs-6.6.2 lib/lhs/concerns/inspect.rb
lhs-6.6.1 lib/lhs/concerns/inspect.rb
lhs-6.6.0 lib/lhs/concerns/inspect.rb
lhs-6.5.0 lib/lhs/concerns/inspect.rb
lhs-6.4.0 lib/lhs/concerns/inspect.rb
lhs-6.3.1 lib/lhs/concerns/inspect.rb
lhs-6.3.0 lib/lhs/concerns/inspect.rb
lhs-6.2.0 lib/lhs/concerns/inspect.rb