Module: TagExtractor
- Defined in:
- lib/tag_extractor.rb
Overview
Public: TagExtractor module contains various classes to handle tag extraction and manipulation. The class uses the principles of separator and containers as a way to separate tags from the rest of the string.
Examples
"#social, economy, #physics, #[web development]"
# Here we have 3 tags : social, physics, web development.
# '#' is the tag separator and [] are the containers,
# needed only when tags are composed of multiple words.
author - Gabriel Dehan (github.com/gabriel-dehan) documentation - github.com/gabriel-dehan/TagExtractor version - 1.0.0
______________
< Tag Extractor >
--------------
\ ^__^
\(00)\_______
(__)\ RUBY )\/\
## ||----w |
|| ||
A minimal ruby library for tag extraction and manipulation.
Defined Under Namespace
Classes: HTMLExtractor, StringExtractor, TagSeparatorError
Constant Summary collapse
- GLOBAL_SEPARATOR =
Public: Constant to be passed to TagExtractor subclasses methods, allowing you to default to the Global Separator you have set through tag_separator=(separator)
nil
- DEFAULT_SEPARATOR =
Public : Constant set with a default separator, namely a sharp symbol (#)
'#'
- @@separator =
GLOBAL_SEPARATOR
- @@default_container =
Public : Constant set with the default container, namely square brackets ([])
DEFAULT_CONTAINER = '[]'
- @@container =
@@default_container
Class Method Summary collapse
-
.tag_separator ⇒ Object
Public: Returns the String tag separator.
-
.tag_separator=(s) ⇒ Object
Public: Sets the String tag separator.
-
.words_container ⇒ Object
(also: multiwords_container)
Public: Returns the String multi-words tag container.
-
.words_container=(c) ⇒ Object
(also: multiwords_container=)
Public: Sets the String multi-words tag container.
Class Method Details
.tag_separator ⇒ Object
Public: Returns the String tag separator.
49 50 51 |
# File 'lib/tag_extractor.rb', line 49 def tag_separator @@separator || raise(TagSeparatorError) end |
.tag_separator=(s) ⇒ Object
Public: Sets the String tag separator.
44 45 46 |
# File 'lib/tag_extractor.rb', line 44 def tag_separator=(s) @@separator = s end |
.words_container ⇒ Object Also known as: multiwords_container
Public: Returns the String multi-words tag container.
60 61 62 |
# File 'lib/tag_extractor.rb', line 60 def words_container @@container || @@default_container end |
.words_container=(c) ⇒ Object Also known as: multiwords_container=
Public: Sets the String multi-words tag container.
54 55 56 |
# File 'lib/tag_extractor.rb', line 54 def words_container=(c) @@container = c end |