Class: Factree::FactsSpy Private

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/factree/facts_spy.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Facts decorator to spy on calls to Factree::Facts#require

Instance Method Summary collapse

Constructor Details

#initialize(facts, &before_require) ⇒ FactsSpy

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of FactsSpy.



6
7
8
9
10
11
# File 'lib/factree/facts_spy.rb', line 6

def initialize(facts, &before_require)
  @facts = facts
  @before_require = before_require
  super(facts)
  freeze
end

Instance Method Details

#[](fact_name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



18
19
20
21
# File 'lib/factree/facts_spy.rb', line 18

def [](fact_name)
  @before_require.call(fact_name)
  super
end

#require(*fact_names) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
16
# File 'lib/factree/facts_spy.rb', line 13

def require(*fact_names)
  @before_require.call(*fact_names)
  super
end