summaryrefslogtreecommitdiff
path: root/deployment_scripts/puppet/files/embedded/lib/ruby/gems/2.3.0/gems/dentaku-2.0.9/lib/dentaku/ast/case/case_conditional.rb
blob: 846590fcac47f68bc908ff84a988037ba8337ba2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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