Sha256: aa66039929890f83ac994d6bc542581694bec12a6134aa67e92990b67335b318

Contents?: true

Size: 561 Bytes

Versions: 1

Compression:

Stored size: 561 Bytes

Contents

# frozen_string_literal: true

module TooDoo
  # Arguments is intended to handle passed args
  # and transform it into command name and its arguments
  # I dont want to use OptionParser!
  class Arguments
    attr_reader :command, :argument

    def initialize(args_array = ARGV)
      @args_array = Array(args_array)
      @command    = recognize_command
      @argument   = recognize_arguments
    end

    private

    def recognize_command
      @args_array.shift || :command_missing
    end

    def recognize_arguments
      @args_array
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
toodoo-0.1.1 lib/toodoo/arguments.rb