Module: Ruleby::RuleHelper

Included in:
Rulebook
Defined in:
lib/rule_helper.rb

Instance Method Summary collapse

Instance Method Details

#__eval__(x) ⇒ Object



51
52
53
# File 'lib/rule_helper.rb', line 51

def __eval__(x)
  eval(x)
end

#AND(*args) ⇒ Object



47
48
49
# File 'lib/rule_helper.rb', line 47

def AND(*args)
  Ruleby::Ferrari::AndBuilder.new args
end

#b(variable_name) ⇒ Object



35
36
37
# File 'lib/rule_helper.rb', line 35

def b(variable_name)
  Ruleby::Ferrari::BindingBuilder.new(variable_name)
end

#c(&block) ⇒ Object



39
40
41
# File 'lib/rule_helper.rb', line 39

def c(&block)
  return lambda(&block)
end

#mObject



27
28
29
# File 'lib/rule_helper.rb', line 27

def m
  Ruleby::Ferrari::MethodBuilder.new
end

#methodObject



31
32
33
# File 'lib/rule_helper.rb', line 31

def method
  m
end

#OR(*args) ⇒ Object



43
44
45
# File 'lib/rule_helper.rb', line 43

def OR(*args)
  Ruleby::Ferrari::OrBuilder.new args
end

#rule(*args, &block) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/rule_helper.rb', line 16

def rule(*args, &block) 
  name = nil
  unless args.empty?
    name = args[0].kind_of?(Symbol) ? args.shift : GeneratedTag.new
  end
  options = args[0].kind_of?(Hash) ? args.shift : {}        

  rules = Ruleby::Ferrari.parse_containers(args, Ruleby::Ferrari::RulesContainer.new).build(name,options,@engine,&block)
  rules
end