Sha256: d25504cab06d5bb63bada9dced01871cb3dc60b9f3d1516e3193aa7d9d5bb2f6

Contents?: true

Size: 595 Bytes

Versions: 4

Compression:

Stored size: 595 Bytes

Contents

module Dentaku
  module AST
    class CaseConditional < Node
      attr_reader :when,
                  :then

      def initialize(when_statement, then_statement)
        @when = when_statement
        unless @when.is_a?(AST::CaseWhen)
          raise 'Expected first argument to be a CaseWhen'
        end
        @then = then_statement
        unless @then.is_a?(AST::CaseThen)
          raise 'Expected second argument to be a CaseThen'
        end
      end

      def dependencies(context = {})
        @when.dependencies(context) + @then.dependencies(context)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dentaku-3.3.0 lib/dentaku/ast/case/case_conditional.rb
dentaku-3.2.1 lib/dentaku/ast/case/case_conditional.rb
dentaku-3.2.0 lib/dentaku/ast/case/case_conditional.rb
dentaku-3.1.0 lib/dentaku/ast/case/case_conditional.rb