Sha256: 95204720cc8c099f53a0ffcc89efd4673626dabd72d3d493a0b11df858c4ee0b

Contents?: true

Size: 567 Bytes

Versions: 2

Compression:

Stored size: 567 Bytes

Contents

module StructuredWarnings
  # The Warner class implements a very simple interface. It simply formats
  # a warning, so it is more than just the message itself. This default
  # warner uses a format comparable to warnings emitted by rb_warn including
  # the place where the "thing that caused the warning" resides.
  class Warner
    #  Warner.new.format(DeprecationWarning, "more info..", caller)
    #     # => "demo.rb:5 : more info.. (DeprecationWarning)"
    def format(warning, message, stack)
      "#{stack.shift} : #{message} (#{warning})"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
structured_warnings-0.2.0 lib/structured_warnings/warner.rb
structured_warnings-0.1.4 lib/structured_warnings/warner.rb