Class: Smartdown::Model::Predicate::OrOperation

Inherits:
Struct
  • Object
show all
Defined in:
lib/smartdown/model/predicate/or_operation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#predicatesObject

Returns the value of attribute predicates

Returns:

  • (Object)

    the current value of predicates



4
5
6
# File 'lib/smartdown/model/predicate/or_operation.rb', line 4

def predicates
  @predicates
end

Instance Method Details

#evaluate(state) ⇒ Object



5
6
7
# File 'lib/smartdown/model/predicate/or_operation.rb', line 5

def evaluate(state)
  predicates.map { |predicate| predicate.evaluate(state) }.any?
end

#humanizeObject



9
10
11
# File 'lib/smartdown/model/predicate/or_operation.rb', line 9

def humanize
  "(#{predicates.map { |p| p.humanize }.join(' OR ')})"
end