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

Version Path
disco_app-0.16.1.pre.sidekiq.pre.6.pre.release app/models/disco_app/concerns/taggable.rb
disco_app-0.15.0 app/models/disco_app/concerns/taggable.rb
disco_app-0.16.0 app/models/disco_app/concerns/taggable.rb
disco_app-0.14.4 app/models/disco_app/concerns/taggable.rb
disco_app-0.16.1 app/models/disco_app/concerns/taggable.rb
disco_app-0.15.2 app/models/disco_app/concerns/taggable.rb