Sha256: 6f3ffae61ea95e6e3d826664943a67b57249bc2fbaea2ea2cc3fda1b3b6a5d2f

Contents?: true

Size: 533 Bytes

Versions: 2

Compression:

Stored size: 533 Bytes

Contents

class TypoDeprecated < StandardError; end

def typo_deprecated(message=nil)
  $typo_deprecated ||= {}
  deprecated_method = caller[0].gsub(/.*\`(.*)\'.*/,'\1')
  called_from = caller[1].gsub(%r{.*/\.\.\/(.*)$},'\1')
  
  warning = "Deprecation warning: #{deprecated_method} called from #{called_from}  #{message}"


  unless ($typo_deprecated[warning])
    RAILS_DEFAULT_LOGGER.error "\n**** #{warning} ****\n"
    $typo_deprecated[warning] = true
  end
  
  if ENV['RAILS_ENV'] == 'test'
    raise TypoDeprecated, warning
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
typo-4.1.1 lib/typo_deprecated.rb
typo-4.1 lib/typo_deprecated.rb