diff --git a/lib/uber/option.rb b/lib/uber/option.rb index b59450d..aa2de13 100644 --- a/lib/uber/option.rb +++ b/lib/uber/option.rb @@ -3,14 +3,17 @@ module Uber class Option def self.[](value, options={}) # TODO: instance_exec: true - if value.is_a?(Proc) + case value + when Proc return ->(context, *args) { context.instance_exec(*args, &value) } if options[:instance_exec] - return value + value + when Uber::Callable + value + when Symbol + ->(context, *args) { context.send(value, *args) } + else + ->(*) { value } end - - return value if value.is_a?(Uber::Callable) - return ->(context, *args){ context.send(value, *args) } if value.is_a?(Symbol) - ->(*) { value } end end end