Module: Trailblazer::Activity::Deprecate

Defined in:
lib/trailblazer/activity/deprecate.rb

Class Method Summary collapse

Class Method Details

.location_for(caller_location) ⇒ Object



13
14
15
16
17
# File 'lib/trailblazer/activity/deprecate.rb', line 13

def location_for(caller_location)
  line_no = caller_location.lineno

  %(#{caller_location.absolute_path}:#{line_no})
end

.warn(caller_location, message) ⇒ Object



6
7
8
9
10
11
# File 'lib/trailblazer/activity/deprecate.rb', line 6

def warn(caller_location, message)
  location = caller_location ? location_for(caller_location) : nil
  warning  = [location, message].compact.join(" ")

  Kernel.warn %([Trailblazer] #{warning}\n)
end