Sha256: dc572af97fb895e0f0397579985866fa69eab731cf78f7f855fefe4a6f136dfb

Contents?: true

Size: 297 Bytes

Versions: 8

Compression:

Stored size: 297 Bytes

Contents

module Klipp
  class ParameterList < Array
    def options
      select { |x| x.to_s[0, 1] == '-' }
    end

    def arguments
      self - options
    end

    def splice_option(name)
      !!delete(name)
    end

    def shift_argument
      (arg = arguments[0]) && delete(arg)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
klipp-0.2.2.5 lib/klipp/parameter_list.rb
klipp-0.2.2.4 lib/klipp/parameter_list.rb
klipp-0.2.2.3 lib/klipp/parameter_list.rb
klipp-0.2.2.2 lib/klipp/parameter_list.rb
klipp-0.2.2.1 lib/klipp/parameter_list.rb
klipp-0.2.2 lib/klipp/parameter_list.rb
klipp-0.2.1 lib/klipp/parameter_list.rb
klipp-0.2.0 lib/klipp/parameter_list.rb