Sha256: 279913229588488063a00c4d3abd57cc14b5dbc4cdab75584ff51a5fb6e868ac
Contents?: true
Size: 695 Bytes
Versions: 1
Compression:
Stored size: 695 Bytes
Contents
module Memo class Option attr_reader :namespace, :is_all def initialize(args) @raw_args = args.to_a case @raw_args in [*, "-n", namespace, *] @namespace = namespace @raw_args.delete("-n") @raw_args.delete(namespace) else end @args = @raw_args.select do |s| !s.start_with? "-" end end def [](index) @args[index] end def dir? include_any? "-dir", "-d" end def all? include_any? "-all", "-a" end def copy? include_any? "-copy", "-c" end private def include_any?(*args) args.map { |a| @raw_args.include?(a) }.any? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ememo-0.1.7 | lib/memo/cli/arg/option.rb |