Sha256: 4a4f34f6371ac6dfc97deb8d7b524a9b2aeab0d9286b323ff1b8f5385cf64d62
Contents?: true
Size: 711 Bytes
Versions: 1
Compression:
Stored size: 711 Bytes
Contents
require_relative './operation' module Dentaku module AST class Combinator < Operation def initialize(*) super unless valid_node?(left) && valid_node?(right) fail ParseError, "#{ self.class } requires logical operands" end end def type :logical end private def valid_node?(node) node && (node.dependencies.any? || node.type == :logical) end end class And < Combinator def value(context={}) left.value(context) && right.value(context) end end class Or < Combinator def value(context={}) left.value(context) || right.value(context) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dentaku-2.0.11 | lib/dentaku/ast/combinators.rb |