blambeau/finitio-rb

View on GitHub
lib/finitio/support/fetch_scope.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Finitio
  class FetchScope

    def initialize(parent, overrides)
      @parent, @overrides = parent, overrides
    end

    def fetch(name, &bl)
      @overrides.fetch(name) do
        @parent.fetch(name, &bl)
      end
    end

    def with(overrides)
      FetchScope.new(self, overrides)
    end

  end # class FetchScope
end # module Finitio