class PoliteText::Base
Public Instance Methods
swear_words()
click to toggle source
# File lib/polite_text/base.rb, line 5 def swear_words @swear_words ||= /\b(#{Regexp.union(swear_words_list).source})\b/ end
swear_words_list()
click to toggle source
# File lib/polite_text/base.rb, line 9 def swear_words_list() path = custom_swear_words_path ? custom_swear_words_path.to_s : swear_words_load_path YAML.load_file(path)['swear_words'] end
Private Instance Methods
custom_swear_words_path()
click to toggle source
# File lib/polite_text/base.rb, line 16 def custom_swear_words_path @custom_swear_words_path ||= PoliteText.custom_swear_words_path end
locale()
click to toggle source
TODO: Implement dynamic locale with I18N
# File lib/polite_text/base.rb, line 21 def locale @locale ||= 'en' end
swear_words_load_path()
click to toggle source
# File lib/polite_text/base.rb, line 25 def swear_words_load_path "#{__dir__}/../locales/#{locale}.yml" end