Method: Caboose::EZ::Condition#define_sub

Defined in:
lib/og/ez/condition.rb

#define_sub(*args, &block) ⇒ Object Also known as: sub, condition

Create subcondition from a block, optionally specifying table_name, outer and inner. :outer determines how the subcondition is added to the condition, while :inner determines the internal ‘joining’ of conditions inside the subcondition. Both :inner & :outer defult to ‘AND’



72
73
74
75
76
77
78
# File 'lib/og/ez/condition.rb', line 72

def define_sub(*args, &block)
  options = args.last.is_a?(Hash) ? args.last : {}
  options[:table_name] = args.first if args.first.kind_of? Symbol
  options[:table_name] ||= @table_name
  cond = Condition.new(options, &block)
  self << cond
end