Sha256: cbddb019b1812b112e6d1ff84942605e1eb6c7b102f837203c539d619a308ccb

Contents?: true

Size: 960 Bytes

Versions: 12

Compression:

Stored size: 960 Bytes

Contents

class Code
  class Node
    class FunctionArgument < Node
      def initialize(argument)
        if argument.key?(:regular)
          @argument =
            ::Code::Node::RegularFunctionArgument.new(argument.fetch(:regular))
        elsif argument.key?(:keyword)
          @argument =
            ::Code::Node::KeywordFunctionArgument.new(argument.fetch(:keyword))
        else
          raise NotImplementedError.new(argument.inspect)
        end
      end

      def evaluate(**args)
        @argument.evaluate(**args)
      end

      def splat?
        @argument.splat?
      end

      def keyword_splat?
        @argument.keyword_splat?
      end

      def name
        @argument.name
      end

      def block?
        @argument.block?
      end

      def regular?
        @argument.is_a?(::Code::Node::RegularFunctionArgument)
      end

      def keyword?
        @argument.is_a?(::Code::Node::KeywordFunctionArgument)
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
template-ruby-0.4.0 lib/code/node/function_argument.rb
code-ruby-0.4.0 lib/code/node/function_argument.rb
template-ruby-0.3.1 lib/code/node/function_argument.rb
code-ruby-0.3.1 lib/code/node/function_argument.rb
template-ruby-0.3.0 lib/code/node/function_argument.rb
code-ruby-0.3.0 lib/code/node/function_argument.rb
code-ruby-0.2.4 lib/code/node/function_argument.rb
template-ruby-0.2.4 lib/code/node/function_argument.rb
template-ruby-0.2.3 lib/code/node/function_argument.rb
template-ruby-0.2.2 lib/code/node/function_argument.rb
template-ruby-0.2.1 lib/code/node/function_argument.rb
template-ruby-0.2.0 lib/code/node/function_argument.rb