class Fixme::Runner
Constants
- RUN_ONLY_IN_THESE_FRAMEWORK_ENVS
Public Class Methods
new(date_and_message)
click to toggle source
# File lib/fixme.rb, line 49 def initialize(date_and_message) @date_and_message = date_and_message end
Public Instance Methods
run()
click to toggle source
# File lib/fixme.rb, line 53 def run return if ENV["DISABLE_FIXME_LIB"] return unless RUN_ONLY_IN_THESE_FRAMEWORK_ENVS.include?(framework_env.to_s) due_date, message = parse disallow_timecop do Fixme.explode(due_date, message) if Date.today >= due_date end end
Private Instance Methods
disallow_timecop(&block)
click to toggle source
# File lib/fixme.rb, line 74 def disallow_timecop(&block) if defined?(Timecop) Timecop.return(&block) else block.call end end
framework_env()
click to toggle source
# File lib/fixme.rb, line 66 def framework_env if defined?(Rails) Rails.env else ENV["RACK_ENV"] || ENV["APP_ENV"] end end
parse()
click to toggle source
# File lib/fixme.rb, line 82 def parse match = @date_and_message.match(/\A(\d\d\d\d-\d\d-\d\d): (.+)\z/) unless match raise %{FIXME does not follow the "2015-01-31: Foo" format: #{@date_and_message.inspect}} end raw_date, message = match.captures [ Date.parse(raw_date), message ] end