Robert K. wrote in post #992088:
>
> or this way
>
> class Opportunities
>   class <<self
>     attr_reader :options
>   end
>
>   def self.using(opts)
>     Class.new(self).tap do |cl|
>       cl.instance_variable_set '@options', opts.freeze
>     end
>   end
> end
>
>

The using() method in your last solution can be simplified:

  def self.using(opts)
    Class.new(self) do
      @options = opts.freeze
    end
  end


And this bit in my last post:

    singleton.singleton_class.class_eval do  #<---SOLUTION***
      def options
        @options
      end
    end

is equivalent to:

    singleton.instance_eval do
      def options
        @options
      end
    end

-- 
Posted via http://www.ruby-forum.com/.