kachick/optionalargument

Without class definition

Closed this issue · 2 comments

Before

CONST = OptionalArgument.define do
  opt :name
end

def func(opts)
  opts = CONST.parse opts
end

After

def func(opts)
  opts = OptionalArgument.parse opts do
    opt :name
  end
end

Just to implement is easy. But I keep to reduce class objects as current code. .parse should cache and reuse the class object when called twice.

#10 (comment) looks hard or impossible for me. (Perfectly cache is not defined with block 😢 )