Class: WAB::Impl::Or

Inherits:
BoolExpr show all
Defined in:
lib/wab/impl/exprs/or.rb

Overview

A logical OR expression.

Instance Method Summary collapse

Methods inherited from BoolExpr

#append_arg

Constructor Details

#initialize(*args) ⇒ Or

Create an OR expression with the provided arguments which must be instances of subclasses of the Expr class.

args

argument to the OR expression



12
13
14
# File 'lib/wab/impl/exprs/or.rb', line 12

def initialize(*args)
  super
end

Instance Method Details

#eval(data) ⇒ Object



16
17
18
19
20
21
# File 'lib/wab/impl/exprs/or.rb', line 16

def eval(data)
  @args.each { |a|
    return true if a.eval(data)
  }
  false
end

#nativeObject



23
24
25
# File 'lib/wab/impl/exprs/or.rb', line 23

def native()
  @args.map(&:native).unshift('OR')
end