Module: Taglish::Taggable

Defined in:
lib/taglish/taggable.rb

Constant Summary collapse

SCORED_TAG_REGEX =
/^(.+):(-?\d+)$/

Instance Method Summary collapse

Instance Method Details

#ordered_taglishObject



13
14
15
# File 'lib/taglish/taggable.rb', line 13

def ordered_taglish
  ordered_taglish_on(:tags)
end

#ordered_taglish_on(*tag_types) ⇒ Object

Make a model taggable on specified contexts.

Example:

class User < ActiveRecord::Base
  scored_taglish_on :languages, :skills
end

Parameters:

  • tag_types (Array)

    An array of taggable contexts



56
57
58
# File 'lib/taglish/taggable.rb', line 56

def ordered_taglish_on(*tag_types)
  taggable_on(true, false, tag_types)
end

#scored_taglishObject



17
18
19
# File 'lib/taglish/taggable.rb', line 17

def scored_taglish
  scored_taglish_on(:tags)
end

#scored_taglish_on(*tag_types) ⇒ Object

Make a model taggable on specified contexts.

Example:

class User < ActiveRecord::Base
  scored_taglish_on :languages, :skills
end

Parameters:

  • tag_types (Array)

    An array of taggable contexts



30
31
32
# File 'lib/taglish/taggable.rb', line 30

def scored_taglish_on(*tag_types)
  taggable_on(false, true, tag_types)
end

#taggable?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/taglish/taggable.rb', line 5

def taggable?
  false
end

#taglishObject



9
10
11
# File 'lib/taglish/taggable.rb', line 9

def taglish
  taglish_on(:tags)
end

#taglish_on(*tag_types) ⇒ Object

Make a model taggable on specified contexts.

Example:

class User < ActiveRecord::Base
  taglish_on :languages, :skills
end

Parameters:

  • tag_types (Array)

    An array of taggable contexts



43
44
45
# File 'lib/taglish/taggable.rb', line 43

def taglish_on(*tag_types)
  taggable_on(false, false, tag_types)
end