Class: RubyEventStore::RSpec::Matchers::ListPhraser

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_event_store/rspec/matchers.rb

Class Method Summary collapse

Class Method Details

.call(object) ⇒ Object


8
9
10
11
12
# File 'lib/ruby_event_store/rspec/matchers.rb', line 8

def call(object)
  items = Array(object).compact.map { |o| format(o) }
  return "" if items.empty?
  items.one? ? items.join : "#{items[all_but_last].join(", ")} and #{items.fetch(-1)}"
end