Class: Rubyhexagon::Search::Tags
- Inherits:
-
Object
- Object
- Rubyhexagon::Search::Tags
- Defined in:
- lib/rubyhexagon/search/tags.rb
Overview
Class to hold methods for Tag searches.
Class Method Summary collapse
-
.aliases(name, page = 1) ⇒ Array<Tag>
Retrieve information about aliased tags.
-
.implications(name, page = 1) ⇒ Array<Tag>
Retrieve information about implicated tags.
-
.list(name, limit = 500, page = 1) ⇒ Array<Tag>
Retrieve a list of post data, which is filtered by arguments.
Class Method Details
.aliases(name, page = 1) ⇒ Array<Tag>
Retrieve information about aliased tags.
82 83 84 85 86 87 88 89 90 91 |
# File 'lib/rubyhexagon/search/tags.rb', line 82 def self.aliases(name, page = 1) params = { aliased_to: name, approved: true, page: page } = fetch_aliases(params) while block_given? && != [] .each { |tag| yield tag unless tag.nil? } = fetch_aliases(params) params[:page] += 1 end .compact end |
.implications(name, page = 1) ⇒ Array<Tag>
Retrieve information about implicated tags.
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/rubyhexagon/search/tags.rb', line 62 def self.implications(name, page = 1) params = { implied_to: name, page: page } = fetch_implications(params) while block_given? && != [] .each { |tag| yield tag unless tag.nil? } = fetch_implications(params) params[:page] += 1 end .compact end |
.list(name, limit = 500, page = 1) ⇒ Array<Tag>
Retrieve a list of post data, which is filtered by arguments. This method accepts a block and returns only one page without one.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/rubyhexagon/search/tags.rb', line 41 def self.list(name, limit = 500, page = 1) params = { name_pattern: name, order: :date, limit: limit, page: page } t = (params) while block_given? && t != [] t.each { |tag| yield tag } params[:page] += 1 t = (params) end t end |