Class: RSpec::Parameterized::Core::LazyArg

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

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ LazyArg

Returns a new instance of LazyArg.



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

def initialize(&block)
  @block = block
end

Instance Method Details

#apply(obj) ⇒ Object



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

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

#inspectObject



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

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