Class: Finitio::FetchScope

Inherits:
Object
  • Object
show all
Defined in:
lib/finitio/support/fetch_scope.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent, overrides) ⇒ FetchScope

Returns a new instance of FetchScope.



4
5
6
# File 'lib/finitio/support/fetch_scope.rb', line 4

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

Instance Method Details

#fetch(name, &bl) ⇒ Object



8
9
10
11
12
# File 'lib/finitio/support/fetch_scope.rb', line 8

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

#with(overrides) ⇒ Object



14
15
16
# File 'lib/finitio/support/fetch_scope.rb', line 14

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