Module: Deprecation
- Defined in:
- lib/vex/base/deprecation.rb
Overview
short inspect method on all objects.
“abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop”.insp
-> "abcdefghijklmnopabcdefghijk..."
Model.find(1).insp
-> "<Model#1>"
Defined Under Namespace
Modules: Etest
Class Method Summary collapse
Class Method Details
.quiet ⇒ Object
10 11 12 13 14 15 |
# File 'lib/vex/base/deprecation.rb', line 10 def self.quiet @quiet = true yield ensure @quiet = false end |
.report(msg, instead = nil) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/vex/base/deprecation.rb', line 21 def self.report(msg, instead=nil) return if App.env == "production" return if @quiet return if seen[[msg, instead]] seen[[msg, instead]] = true msg = "#{msg} is deprecated" msg += "; use #{instead} instead" if instead msg += ". From\n\t" + caller[1,4].join("\n\t") STDERR.puts msg end |
.seen ⇒ Object
17 18 19 |
# File 'lib/vex/base/deprecation.rb', line 17 def self.seen @seen ||= {} end |