Module: FeatureCop::Sampling::ClassMethods

Defined in:
lib/feature_cop/sampling.rb

Instance Method Summary collapse

Instance Method Details

#sample10(feature, identifier, options = {}) ⇒ Object



9
10
11
12
13
# File 'lib/feature_cop/sampling.rb', line 9

def sample10(feature, identifier, options = {})
  return true if whitelisted?(feature, identifier, options)
  return false if blacklisted?(feature, identifier, options)
  identifier.bytes.sum % 10 == 0 
end

#sample30(feature, identifier, options = {}) ⇒ Object



15
16
17
18
19
# File 'lib/feature_cop/sampling.rb', line 15

def sample30(feature, identifier, options = {})
  return true if whitelisted?(feature, identifier, options)
  return false if blacklisted?(feature, identifier, options)
  identifier.bytes.sum % 3 == 0 
end

#sample50(feature, identifier, options = {}) ⇒ Object



21
22
23
24
25
# File 'lib/feature_cop/sampling.rb', line 21

def sample50(feature, identifier, options = {})
  return true if whitelisted?(feature, identifier, options)
  return false if blacklisted?(feature, identifier, options)
  identifier.bytes.sum.odd? 
end