module FlipFlop::Gates
Public Instance Methods
after_date(value, actor)
click to toggle source
# File lib/flip-flop/gates.rb, line 17 def after_date(value, actor) Date.today > value end
after_time(value, actor)
click to toggle source
# File lib/flip-flop/gates.rb, line 29 def after_time(value, actor) Time.now.utc > value end
boolean(value, actor)
click to toggle source
# File lib/flip-flop/gates.rb, line 5 def boolean(value, actor) value end
date_range(value, actor)
click to toggle source
# File lib/flip-flop/gates.rb, line 9 def date_range(value, actor) value.begin < Date.today && value.end > Date.today end
group(group_name, actor)
click to toggle source
# File lib/flip-flop/gates.rb, line 41 def group(group_name, actor) Group.evaluate_group(group_name, actor) end
percentage_of_time(value, actor)
click to toggle source
# File lib/flip-flop/gates.rb, line 33 def percentage_of_time(value, actor) rand < (value / 100.0) end
rails_env(value, actor)
click to toggle source
# File lib/flip-flop/gates.rb, line 37 def rails_env(value, actor) value == Rails.env.to_sym || value.include?(Rails.env.to_sym) end
time_range(value, actor)
click to toggle source
# File lib/flip-flop/gates.rb, line 21 def time_range(value, actor) value.begin < Time.now.utc && value.end > Time.now.utc end
until_date(value, actor)
click to toggle source
# File lib/flip-flop/gates.rb, line 13 def until_date(value, actor) Date.today < value end
until_time(value, actor)
click to toggle source
# File lib/flip-flop/gates.rb, line 25 def until_time(value, actor) Time.now.utc < value end