Class: RSpec::Tabular::Wrapped

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/tabular/wrapped.rb

Overview

This class is a wrapper around a proc that will indicate to tabular that the provided proc should be run against a spec’s context such that variables defined with let and helper methods like instance_double are available.

This class should not be called directly. Instead use the helper function ‘with_context`

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(proc, pretty_val = nil) ⇒ Wrapped

Returns a new instance of Wrapped.



13
14
15
16
# File 'lib/rspec/tabular/wrapped.rb', line 13

def initialize(proc, pretty_val = nil)
  @proc       = proc
  @pretty_val = pretty_val
end

Instance Attribute Details

#procObject (readonly)

Returns the value of attribute proc.



18
19
20
# File 'lib/rspec/tabular/wrapped.rb', line 18

def proc
  @proc
end

Instance Method Details

#to_sObject Also known as: inspect



20
21
22
# File 'lib/rspec/tabular/wrapped.rb', line 20

def to_s
  @pretty_val || 'wrapped_value'
end