Class: PoliteText::TextScanner
- Defined in:
- lib/polite_text/text_scanner.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text) ⇒ TextScanner
constructor
A new instance of TextScanner.
- #match_swear_word? ⇒ Boolean
Methods inherited from Base
#swear_words, #swear_words_list
Constructor Details
#initialize(text) ⇒ TextScanner
Returns a new instance of TextScanner.
5 6 7 8 9 |
# File 'lib/polite_text/text_scanner.rb', line 5 def initialize(text) raise ArgumentError.new('The text can not be nil') if text.nil? @text = text.to_s end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
3 4 5 |
# File 'lib/polite_text/text_scanner.rb', line 3 def text @text end |
Instance Method Details
#match_swear_word? ⇒ Boolean
11 12 13 |
# File 'lib/polite_text/text_scanner.rb', line 11 def match_swear_word? !@text.match?(swear_words) end |