Sha256: d05ae23c6f4823a5aa03a8935377e43a6254d66c0eb63f93ba094074e9847199

Contents?: true

Size: 692 Bytes

Versions: 6

Compression:

Stored size: 692 Bytes

Contents

require_relative './node'

module Dentaku
  module AST
    class Operation < Node
      attr_reader :left, :right

      def self.min_param_count
        arity
      end

      def self.max_param_count
        arity
      end

      def initialize(left, right)
        @left  = left
        @right = right
      end

      def dependencies(context = {})
        (left.dependencies(context) + right.dependencies(context)).uniq
      end

      def self.right_associative?
        false
      end

      def accept(visitor)
        visitor.visit_operation(self)
      end

      def display_operator
        operator.to_s
      end
      alias_method :to_s, :display_operator
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
dentaku-3.5.4 lib/dentaku/ast/operation.rb
dentaku-3.5.3 lib/dentaku/ast/operation.rb
dentaku-3.5.2 lib/dentaku/ast/operation.rb
dentaku_zevo-3.5.2 lib/dentaku/ast/operation.rb
dentaku-3.5.1 lib/dentaku/ast/operation.rb
dentaku-3.5.0 lib/dentaku/ast/operation.rb