Class: WAB::Impl::And

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

Overview

A logical AND expression.

Instance Method Summary collapse

Methods inherited from BoolExpr

#append_arg

Constructor Details

#initialize(*args) ⇒ And

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

args

argument to the AND expression



12
13
14
# File 'lib/wab/impl/exprs/and.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/and.rb', line 16

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

#nativeObject



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

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