Sha256: cf55287794ef9386c9ef072ea181d55af50b6a0d445590c56cf6181b363b8769
Contents?: true
Size: 369 Bytes
Versions: 6
Compression:
Stored size: 369 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
6 entries across 6 versions & 1 rubygems