Sha256: a9f5918498b587b9466e0a06e4ddff4649b289f3d0ada0fbc69a7c93dc65eb4c
Contents?: true
Size: 368 Bytes
Versions: 9
Compression:
Stored size: 368 Bytes
Contents
module DiscoApp::Concerns::Taggable extend ActiveSupport::Concern def tags data[:tags].split(',').map(&:strip) end def add_tag(tag) data[:tags] = (tags + [tag]).uniq.join(',') end def remove_tag(tag) data[:tags] = (tags - [tag]).uniq.join(',') end def has_tag?(tag_to_check) tags.any? { |tag| tag.casecmp(tag_to_check) } end end
Version data entries
9 entries across 9 versions & 1 rubygems