Method: Lookbook::EntityCollection#previous

Defined in:
lib/lookbook/entities/collections/entity_collection.rb

#previous(entity) ⇒ Object



38
39
40
41
# File 'lib/lookbook/entities/collections/entity_collection.rb', line 38

def previous(entity)
  index = entities.find_index { |i| i.path == entity.path }
  entities[index - 1] if !index.nil? && index > 0
end