Module: RSpec::Debugging::LetVariables

Extended by:
LetVariables
Included in:
LetVariables
Defined in:
lib/rspec/debugging/let_variables.rb

Instance Method Summary collapse

Instance Method Details

#let_variable_get(name) ⇒ Object



12
13
14
# File 'lib/rspec/debugging/let_variables.rb', line 12

def let_variable_get(name)
  __memoized.instance_variable_get("@memoized")[name]
end

#let_variable_initialized?(name) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/rspec/debugging/let_variables.rb', line 8

def let_variable_initialized?(name)
  __memoized.instance_variable_get("@memoized").key?(name)
end

#let_variable_locations(name) ⇒ Object



20
21
22
23
24
# File 'lib/rspec/debugging/let_variables.rb', line 20

def let_variable_locations(name)
  let_variable_methods(self)[name].map do |fn|
    normalize_path(fn.source_location.join(":"))
  end
end

#let_variable_reset(name) ⇒ Object



16
17
18
# File 'lib/rspec/debugging/let_variables.rb', line 16

def let_variable_reset(name)
  __memoized.instance_variable_get("@memoized").delete(name)
end

#let_variable_values(name) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/rspec/debugging/let_variables.rb', line 26

def let_variable_values(name)
  let_variable_methods(self)[name].map do |fn|
    {
      normalize_path(fn.source_location.join(":")) => fn.bind(self).call
    }
  end
end

#let_variablesObject



4
5
6
# File 'lib/rspec/debugging/let_variables.rb', line 4

def let_variables
  let_variable_methods(self).keys
end