Class: Trebuchet::Strategy::PerDenomination

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

Instance Attribute Summary

Attributes included from PerDenominationable

#denominator, #numerator

Attributes inherited from Base

#feature

Instance Method Summary collapse

Methods included from PerDenominationable

#export, #initialize, #to_s, #value_in_range?

Methods inherited from Base

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

Instance Method Details

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

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/trebuchet/strategy/per_denomination.rb', line 11

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

#set_range_from_options(options = {}) ⇒ Object



4
5
6
7
8
9
# File 'lib/trebuchet/strategy/per_denomination.rb', line 4

def set_range_from_options(options = {})
  numerator = options['numerator'] || options[:numerator] || 0
  denominator = options['denominator'] || options[:denominator] || 0

  super(numerator: numerator, denominator: denominator)
end