Class: Peeek::Calls

Inherits:
Array
  • Object
show all
Defined in:
lib/peeek/calls.rb

Instance Method Summary collapse

Instance Method Details

#at(line) ⇒ Peeek::Calls

Filter the calls by line number.

Parameters:

  • line (Number, Range<Number>)

    line number or range of lines

Returns:



16
17
18
# File 'lib/peeek/calls.rb', line 16

def at(line)
  Calls.new(select { |call| line === call.line })
end

#exceptionsPeeek::Calls

Filter only the calls that an exception raised.

Returns:



38
39
40
# File 'lib/peeek/calls.rb', line 38

def exceptions
  Calls.new(select(&:raised?))
end

#from(receiver) ⇒ Peeek::Calls

Filter the calls by a receiver.

Parameters:

  • receiver (Module, Class, Object)

Returns:



24
25
26
# File 'lib/peeek/calls.rb', line 24

def from(receiver)
  Calls.new(select { |call| call.receiver == receiver })
end

#in(file) ⇒ Peeek::Calls

Filter the calls by name of a file.

Parameters:

  • file (String, Regexp)

    name or pattern of a file

Returns:



8
9
10
# File 'lib/peeek/calls.rb', line 8

def in(file)
  Calls.new(select { |call| file === call.file })
end

#return_valuesPeeek::Calls

Filter only the calls that a value returned.

Returns:



31
32
33
# File 'lib/peeek/calls.rb', line 31

def return_values
  Calls.new(select(&:returned?))
end