Sha256: dcc93b0c8ae9dbed85c2779d558a2d51c06b8e99ec869a27fbb7d9c800716165

Contents?: true

Size: 595 Bytes

Versions: 4

Compression:

Stored size: 595 Bytes

Contents

module Eco
  class Scripting
    class Argument

      attr_reader :key

      def initialize(key, with_param: false)
        @key        = key
        @with_param = !!with_param
      end

      def args_slice(*args)
        #pp "known arg '#{key}' => included? #{args.include?(key)}"
        return args unless args.include?(key)
        i = args.index(key)
        j = with_param?? i+1 : i
        args - args.slice(i..j)
      end

      def with_param!
        @with_param = true
      end

      def with_param?
        @with_param
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
eco-helpers-0.8.3 lib/eco/scripting/argument.rb
eco-helpers-0.8.2 lib/eco/scripting/argument.rb
eco-helpers-0.8.1 lib/eco/scripting/argument.rb
eco-helpers-0.7.2 lib/eco/scripting/argument.rb