```ruby
class Duffel
  VERSION = "0.0.1"

  def self.method_missing(method, *args, &block)
    fetch_default = lambda do |key|
      raise KeyError.new("key not found: #{key}")
    end

    define_singleton_method(method) do |options=(args.first || {})|
      return_value = options.fetch(:fallback, fetch_default)
      fallback = return_value.is_a?(Proc) ? return_value : lambda { |key| return_value }

      env_name = method.to_s.upcase
      ENV.fetch(env_name, &fallback)
    end
    self.send(method)
  end
end
```

Refactor some code. - format_return_value becomes it's own method instead of a one line ternary operator. - fetch_default is a method instead of a variable defined inside the method_missing block.
user
```ruby
class Duffel
  VERSION = "0.0.1"

  class << self

    def method_missing(method, *args, &block)
      define_singleton_method(method) do |options=(args.first || {})|
        return_value = options.fetch(:fallback, fetch_default)
        fallback = format_return_value(return_value)

        env_name = method.to_s.upcase
        ENV.fetch(env_name, &fallback)
      end
      self.send(method)
    end

  protected

    def format_return_value(value)
      if value.is_a?(Proc)
        value
      else
        lambda { |_key| value }
      end
    end

    def fetch_default
      lambda do |key|
        raise KeyError.new("key not found: #{key}")
      end
    end
  end
end
```
assistant