Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/tag_extractor.rb

Instance Method Summary collapse

Instance Method Details

Public: Native String helper for TagExtractor::HTMLExtractor#convert_tags_to_html_links. See API for TagExtractor::HTMLExtractor#convert_tags_to_html_links

Returns an HTML String.



243
244
245
# File 'lib/tag_extractor.rb', line 243

def convert_tags_to_html_links(separator = nil, container = nil, opts = { multiword: true }, &block)
  TagExtractor::HTMLExtractor.new(self).convert_tags_to_html_links(separator, container, opts, &block)
end

#extract_tags(separator = nil, container = nil, opts = { multiword: true }, with_separator = false) ⇒ Object

Public: Native String helper for TagExtractor::StringExtractor#extract_tags.

separator - a separator to use for tag extraction.

If none specified, it will default to the global separator.

container - a container to use for tag extraction.

If none specified, it will default to the default container.

opts - A hash with options for the extraction (default: { multiword => true } ).

:multiword - A boolean to indicate if multiple words tags are to extracted.

with_separator - A Boolean specifying if the tags are to be return with or without separators (default: false).

Returns an Array of tags : [“#tag1”, “#[long tag]”, “#tag2”] or [“tag1”, “long tag”, “tag2”].



231
232
233
234
235
236
237
# File 'lib/tag_extractor.rb', line 231

def extract_tags(separator = nil, container = nil, opts = { multiword:  true }, with_separator = false)
  if with_separator
    TagExtractor::StringExtractor.new(self).extract_with_separator(separator, container, opts)
  else
    TagExtractor::StringExtractor.new(self).extract(separator, container, opts)
  end
end