Class: RSpec::Parameterized::LazyArg

Inherits:
Arg
  • Object
show all
Defined in:
lib/rspec/parameterized/lazy_arg.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ LazyArg

Returns a new instance of LazyArg.



4
5
6
# File 'lib/rspec/parameterized/lazy_arg.rb', line 4

def initialize(&block)
  @block = block
end

Instance Method Details

#apply(obj) ⇒ Object



8
9
10
# File 'lib/rspec/parameterized/lazy_arg.rb', line 8

def apply(obj)
  obj.instance_eval(&@block)
end

#inspectObject



12
13
14
15
16
# File 'lib/rspec/parameterized/lazy_arg.rb', line 12

def inspect
  "#{@block.to_raw_source}"
rescue Parser::SyntaxError
  super.inspect
end