class Lookbook::EntityStore
def add(*entities)
def add(*entities) entities.each { @entities.push(_1) } end
def all = @entities
def all = @entities
def include?(entity)
def include?(entity) !index(entity).nil? end
def index(entity)
def index(entity) @entities.index { _1.id == entity.id } end
def initialize
def initialize @entities = [] end
def remove(*entities)
def remove(*entities) entities.each do |entity| i = index(entity) @entities.delete_at(i) unless i.nil? end end
def replace(*entities)
def replace(*entities) entities.each do |entity| i = index(entity) @entities[i] = entity unless i.nil? end end
def replace_all(entities)
def replace_all(entities) clear add(*entities) end
def to_data
def to_data @entities.map(&:to_h) end