module Profane
Constants
- DICTIONARY_PATH
- VERSION
Public Class Methods
character()
click to toggle source
# File lib/profane.rb, line 32 def self.character config[:filter_character] || '*' end
config()
click to toggle source
# File lib/profane.rb, line 12 def self.config @config ||= set_default_config end
configure(options)
click to toggle source
# File lib/profane.rb, line 8 def self.configure(options) config.merge!(options) end
dictionary()
click to toggle source
# File lib/profane.rb, line 20 def self.dictionary stringify_keys(load_dictionary) end
load_custom_yaml_dictionary()
click to toggle source
# File lib/profane.rb, line 60 def self.load_custom_yaml_dictionary path = config[:dictionary_file] if path && File.exist?(path) YAML.load(File.read(config[:dictionary_file])) else {} end end
load_dictionary()
click to toggle source
# File lib/profane.rb, line 36 def self.load_dictionary yaml_dictionary = load_yaml_dictionary if config[:use_internal_dictionary] yaml_dictionary.merge (config[:dictionary] || {}) else config[:dictionary] end end
load_internal_yaml_dictionary()
click to toggle source
# File lib/profane.rb, line 56 def self.load_internal_yaml_dictionary internal_dictionary = YAML.load(File.read(DICTIONARY_PATH)) end
load_yaml_dictionary()
click to toggle source
# File lib/profane.rb, line 46 def self.load_yaml_dictionary custom_dictionary = load_custom_yaml_dictionary if config[:use_internal_dictionary] load_internal_yaml_dictionary.merge custom_dictionary else custom_dictionary end end
set_default_config()
click to toggle source
# File lib/profane.rb, line 16 def self.set_default_config @config = { use_internal_dictionary: true } end
stringify_keys(hash)
click to toggle source
# File lib/profane.rb, line 24 def self.stringify_keys(hash) hash.keys.each do |key| hash[key.to_s] = hash.delete(key) end hash end