Sha256: 811ab4547424c872e57eb5b58c4ede3f916cf79e532bcc648e160edd03087a24

Contents?: true

Size: 374 Bytes

Versions: 3

Compression:

Stored size: 374 Bytes

Contents

module Shifty
  module Taggable
    def tags=(tag_arg)
      @tags = [tag_arg].flatten.compact
    end

    def criteria=(criteria_arg)
      @criteria = [criteria_arg].flatten.compact
    end

    def has_tag?(tag)
      @tags.include? tag
    end

    def criteria_passes?
      return true if @criteria.empty?

      @criteria.all? { |c| c.call(self) }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shifty-0.4.2 lib/shifty/taggable.rb
shifty-0.4.1 lib/shifty/taggable.rb
shifty-0.4.0 lib/shifty/taggable.rb