module RSpec::Formatters

Public Class Methods

filter(illustrations, filter_key) click to toggle source

@private @param illustrations [Array<Hash>] A list of illustrations ({ Hash }) @param filter_key [Symbol] The property that each illustration must have. @return [Array<Hash>] The illustrations that have truthy property values for

filter_key.
# File lib/rspec/formatters/illustration_formatter.rb, line 21
def filter(illustrations, filter_key)
  illustrations.select{|illustration| illustration[filter_key]}
end
illustrations_of(notification) click to toggle source

@private @param notification [RSpec::Core::Notifications::ExampleNotification]

The example notification to be formatted.

@return [Array<Hash>] The list of illustrations in the example, where each

illustration is represented by a { Hash } containing its properties.
# File lib/rspec/formatters/illustration_formatter.rb, line 10
def illustrations_of(notification)
  notification.example.metadata[:illustrations] || []
end

Private Instance Methods

filter(illustrations, filter_key) click to toggle source

@private @param illustrations [Array<Hash>] A list of illustrations ({ Hash }) @param filter_key [Symbol] The property that each illustration must have. @return [Array<Hash>] The illustrations that have truthy property values for

filter_key.
# File lib/rspec/formatters/illustration_formatter.rb, line 21
def filter(illustrations, filter_key)
  illustrations.select{|illustration| illustration[filter_key]}
end
illustrations_of(notification) click to toggle source

@private @param notification [RSpec::Core::Notifications::ExampleNotification]

The example notification to be formatted.

@return [Array<Hash>] The list of illustrations in the example, where each

illustration is represented by a { Hash } containing its properties.
# File lib/rspec/formatters/illustration_formatter.rb, line 10
def illustrations_of(notification)
  notification.example.metadata[:illustrations] || []
end