Class: Trebuchet::Strategy::Percent

Inherits:
Base
  • Object
show all
Includes:
Percentable
Defined in:
lib/trebuchet/strategy/percent.rb

Instance Attribute Summary

Attributes included from PerDenominationable

#denominator, #numerator

Attributes inherited from Base

#feature

Instance Method Summary collapse

Methods included from Percentable

#export, #set_range_from_options, #to_s

Methods included from PerDenominationable

#export, #set_range_from_options, #to_s, #value_in_range?

Methods inherited from Base

#as_json, #export, #feature_id, #inspect, #name, #needs_user?, strategy_name

Constructor Details

#initialize(options) ⇒ Percent

Returns a new instance of Percent.



5
6
7
# File 'lib/trebuchet/strategy/percent.rb', line 5

def initialize(options)
  set_range_from_options(options)
end

Instance Method Details

#launch_at?(user, request = nil) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
# File 'lib/trebuchet/strategy/percent.rb', line 9

def launch_at?(user, request = nil)
  return false unless user && user.id
  value_in_range?(user.id.to_i)
end