Class: PrepareTextService
- Inherits:
-
Object
- Object
- PrepareTextService
- Defined in:
- lib/services/prepare_text_service.rb
Constant Summary collapse
- SPECIAL_CHARACTERS =
/([•|—|–|\-|\’|,|?|!|^|\r|°|“|”|...|\u00a0|«|»|…|\\|\/|!|?|\"|\'|\[|\]|\(|\)|\]|<|>|=|+|%|$|&|#|;|*|:|}|{|`])/.freeze
Instance Attribute Summary collapse
-
#prepared_text ⇒ Object
Returns the value of attribute prepared_text.
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(text) ⇒ PrepareTextService
constructor
A new instance of PrepareTextService.
Constructor Details
#initialize(text) ⇒ PrepareTextService
Returns a new instance of PrepareTextService.
8 9 10 11 |
# File 'lib/services/prepare_text_service.rb', line 8 def initialize(text) @text = text @prepared_text = text.dup end |
Instance Attribute Details
#prepared_text ⇒ Object
Returns the value of attribute prepared_text.
6 7 8 |
# File 'lib/services/prepare_text_service.rb', line 6 def prepared_text @prepared_text end |
#text ⇒ Object
Returns the value of attribute text.
6 7 8 |
# File 'lib/services/prepare_text_service.rb', line 6 def text @text end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/services/prepare_text_service.rb', line 13 def call downcase_text! remove_special_characters! split_text! wordify_numbers! prepared_text end |