Class: Fixme::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/fixme.rb

Constant Summary collapse

RUN_ONLY_IN_FRAMEWORK_ENVS =
[ "", "test", "development" ]

Instance Method Summary collapse

Constructor Details

#initialize(date_and_message) ⇒ Runner

Returns a new instance of Runner.



18
19
20
# File 'lib/fixme.rb', line 18

def initialize(date_and_message)
  @date_and_message = date_and_message
end

Instance Method Details

#runObject



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fixme.rb', line 22

def run
  return if ENV["DO_NOT_RAISE_FIXMES"]
  return unless RUN_ONLY_IN_FRAMEWORK_ENVS.include?(framework_env.to_s)

  due_date, message = parse

  disallow_timecop do
    if Date.today >= due_date
      raise UnfixedError, "Fix by #{due_date}: #{message}"
    end
  end
end