Sha256: 2fe022a83b3777a02abfd8e4a555fa965c3a9a98544ac1283bac856b73a88b97

Contents?: true

Size: 568 Bytes

Versions: 3

Compression:

Stored size: 568 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

3 entries across 3 versions & 1 rubygems

Version Path
structured_warnings-0.1.3 lib/structured_warnings/warner.rb
structured_warnings-0.1.2 lib/structured_warnings/warner.rb
structured_warnings-0.1.1 lib/structured_warnings/warner.rb