Sha256: d4f385570346efd774fee37ce500f77d148f2acc24e984f9bc3c9a003b55c917

Contents?: true

Size: 780 Bytes

Versions: 6

Compression:

Stored size: 780 Bytes

Contents

module CukeModeler

  # NOT A PART OF THE PUBLIC API
  # A mix-in module containing methods used by models that represent an element that can be tagged.

  module Taggable

    # The models for tags which are directly assigned to the element
    attr_accessor :tags


    # Returns the models for tags which are indirectly assigned to the element (i.e. they
    # have been inherited from a parent element).
    def applied_tags
      parent_model.respond_to?(:all_tags) ? parent_model.all_tags : []
    end

    # Returns models for all of the tags which are applicable to the element.
    def all_tags
      applied_tags + @tags
    end


    private


    def tag_output_string
      tags.collect { |tag| tag.name }.join(' ')
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
cuke_modeler-3.3.0 lib/cuke_modeler/taggable.rb
cuke_modeler-3.2.0 lib/cuke_modeler/taggable.rb
cuke_modeler-3.1.0 lib/cuke_modeler/taggable.rb
cuke_modeler-3.0.0 lib/cuke_modeler/taggable.rb
cuke_modeler-2.1.0 lib/cuke_modeler/taggable.rb
cuke_modeler-2.0.0 lib/cuke_modeler/taggable.rb