Class: Roqua::Healthy::MessageCleaner
- Inherits:
-
Object
- Object
- Roqua::Healthy::MessageCleaner
- Defined in:
- lib/roqua/healthy/message_cleaner.rb
Instance Method Summary collapse
- #clean(thing) ⇒ Object
- #clean_array(array) ⇒ Object
- #clean_hash(hash) ⇒ Object
- #clean_string(string) ⇒ Object
-
#initialize(message) ⇒ MessageCleaner
constructor
A new instance of MessageCleaner.
- #message ⇒ Object
Constructor Details
#initialize(message) ⇒ MessageCleaner
Returns a new instance of MessageCleaner.
4 5 6 |
# File 'lib/roqua/healthy/message_cleaner.rb', line 4 def initialize() = end |
Instance Method Details
#clean(thing) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/roqua/healthy/message_cleaner.rb', line 12 def clean(thing) case thing when Hash clean_hash(thing) when Array clean_array(thing) when String clean_string(thing) else thing end end |
#clean_array(array) ⇒ Object
32 33 34 35 36 |
# File 'lib/roqua/healthy/message_cleaner.rb', line 32 def clean_array(array) array.map do |value| clean(value) end end |
#clean_hash(hash) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/roqua/healthy/message_cleaner.rb', line 25 def clean_hash(hash) hash.each do |key, value| hash[key] = clean(value) end hash end |
#clean_string(string) ⇒ Object
38 39 40 41 |
# File 'lib/roqua/healthy/message_cleaner.rb', line 38 def clean_string(string) return '' if string == '""' string.strip end |
#message ⇒ Object
8 9 10 |
# File 'lib/roqua/healthy/message_cleaner.rb', line 8 def clean_hash() end |