Class: Lookout::Expect::Object::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/lookout-3.0/expect/object/context.rb

Overview

Context in which expect blocks are evaluated. Plug-ins may add private methods to this class to make them available to expect blocks.

Instance Method Summary collapse

Constructor Details

#initialize(*args, &block) ⇒ Context

Evaluates BLOCK inside this context, passing ARGS to it, when #evaluated.

Parameters:



8
9
10
# File 'lib/lookout-3.0/expect/object/context.rb', line 8

def initialize(*args, &block)
  @args, @block = args, block
end

Instance Method Details

#evaluate::Object?

Returns The result of evaluating the block or nil if there’s no block.

Returns:

  • (::Object, nil)

    The result of evaluating the block or nil if there’s no block



14
15
16
# File 'lib/lookout-3.0/expect/object/context.rb', line 14

def evaluate
  instance_exec(*@args, &@block) if @block
end