module AbRules

Public Class Methods

rule(content, &block) click to toggle source
# File lib/ab_rules.rb, line 19
def self.rule(content, &block)
  Rule.new(content, &block)
end
split_by_id(id, *alternatives) { |content| ... } click to toggle source
# File lib/ab_rules.rb, line 23
def self.split_by_id(id, *alternatives)
  content = alternatives.flatten[id % alternatives.size]
  block_given? ? yield(content) : content
end
split_by_rule(subjects = {}, *rules) { |content| ... } click to toggle source
# File lib/ab_rules.rb, line 28
def self.split_by_rule(subjects = {}, *rules)
  content = rules.flatten.find { |r| r.match?(subjects) }.apply
  block_given? ? yield(content) : content
end