class Ettu
  class Configuration < ActiveSupport::OrderedOptions
    def initialize
      super
      set_defaults
    end

    def reset
      set_defaults
    end


    private

    def set_defaults
      self.assets = LateLoadAssets.new(self, :assets)

      # Don't actually set view by default.
      # This'll allow #fetch to return the real default
      # at runtime.
      # self.view = "#{controller_name}/#{action_name}"
      delete :view if key? :view

      self.template_digestor = LateLoadTempalteDigestor.new(self, :template_digestor)
    end

    class LateLoad
      def initialize(config, name)
        @config = config
        @name = name
      end

      def method_missing(method, *args, &block)
        late_load = defaults
        @config[@name] = late_load
        late_load.send method, *args, &block
      end
    end

    class LateLoadTempalteDigestor < LateLoad
      def defaults
        ::ActionView::Digestor
      end
    end

    class LateLoadAssets < LateLoad
      def defaults
        Array.new(::ActionView::Base.assets_manifest.assets.keys)
      end
    end
  end
end

class Ettu
  class Configuration < ActiveSupport::OrderedOptions
    def initialize
      super
      set_defaults
    end

    def reset
      set_defaults
    end


    private

    def set_defaults
      self.assets = LateLoadAssets.new(self, :assets)

      # Don't actually set view by default.
      # This'll allow #fetch to return the real default
      # at runtime.
      # self.view = "#{controller_name}/#{action_name}"
      delete :view if key? :view

      self.template_digestor = LateLoadTempalteDigestor.new(self, :template_digestor)
    end

    class LateLoad
      def initialize(config, name)
        @config = config
        @name = name
      end

      def method_missing(method, *args, &block)
        late_load = defaults
        @config[@name] = late_load
        late_load.send method, *args, &block
      end
    end

    class LateLoadTempalteDigestor < LateLoad
      def defaults
        ::ActionView::Digestor
      end
    end

    class LateLoadAssets < LateLoad
      def defaults
        ::ActionView::Base.assets_manifest.assets.keys
      end
    end
  end
end

Fix recursion error in JRuby and RBX
Fix recursion error in JRuby and RBX
