Parent

Included Modules

Files

Thoth::Tag

Public Class Methods

suggest(query, limit = 1000) click to toggle source

Gets an array of tag names and post counts for tags with names that begin with the specified query string.

# File lib/thoth/model/tag.rb, line 48
def self.suggest(query, limit = 1000)
  tags = []

  self.dataset.grep(:name, "#{query}%").all do |tag|
    tags << [tag.name, tag.posts.count]
  end

  tags.sort!{|a, b| b[1] <=> a[1]}
  tags[0, limit]
end

Public Instance Methods

atom_url() click to toggle source

Gets the Atom feed URL for this tag.

# File lib/thoth/model/tag.rb, line 64
def atom_url
  Config.site.url.chomp('/') + R(TagController, :atom, CGI.escape(name))
end
posts() click to toggle source

Gets posts with this tag.

# File lib/thoth/model/tag.rb, line 69
def posts
  @posts ||= posts_dataset.reverse_order(:created_at)
end
url() click to toggle source

URL for this tag.

# File lib/thoth/model/tag.rb, line 74
def url
  Config.site.url.chomp('/') + R(TagController, CGI.escape(name))
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.