Module: PoliteText

Defined in:
lib/polite_text.rb,
lib/polite_text/base.rb,
lib/polite_text/version.rb,
lib/polite_text/text_cleaner.rb,
lib/polite_text/text_scanner.rb

Defined Under Namespace

Classes: Base, TextCleaner, TextScanner

Constant Summary collapse

VERSION =
"0.3.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.custom_swear_words_pathObject

Returns the value of attribute custom_swear_words_path.



7
8
9
# File 'lib/polite_text.rb', line 7

def custom_swear_words_path
  @custom_swear_words_path
end

Class Method Details

.be_polite!(text) ⇒ Object



14
15
16
# File 'lib/polite_text.rb', line 14

def be_polite!(text)
  PoliteText::TextCleaner.new(text).clean!
end

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (PoliteText)

    the object that the method was called on



9
10
11
12
# File 'lib/polite_text.rb', line 9

def configure
  yield self if block_given?
  check_attrs
end

.is_polite?(text) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/polite_text.rb', line 18

def is_polite?(text)
  PoliteText::TextScanner.new(text).match_swear_word?
end