Collapse iteration to a map
This commit is contained in:
parent
750d7bb2c8
commit
977ae5f27d
@ -36,16 +36,7 @@ class Options
|
||||
include Enumerable
|
||||
|
||||
def self.create(array)
|
||||
options = new
|
||||
array.each do |e|
|
||||
case e
|
||||
when /^--(.+)$/
|
||||
options << Option.new($1)
|
||||
else
|
||||
options << Option.new(e)
|
||||
end
|
||||
end
|
||||
options
|
||||
new array.map { |e| Option.new(e[/^--(.+)$/, 1] || e) }
|
||||
end
|
||||
|
||||
def initialize(*args)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user