Class: CrmFormatter::Proper
- Inherits:
-
Object
- Object
- CrmFormatter::Proper
- Defined in:
- lib/crm_formatter/proper.rb
Instance Method Summary collapse
-
#check_proper_status(hsh) ⇒ Object
COMPARE ORIGINAL AND FORMATTED PROPER ######.
- #format_proper(string) ⇒ Object
Instance Method Details
#check_proper_status(hsh) ⇒ Object
COMPARE ORIGINAL AND FORMATTED PROPER ######
13 14 15 16 17 18 19 20 |
# File 'lib/crm_formatter/proper.rb', line 13 def check_proper_status(hsh) proper = hsh[:proper] proper_f = hsh[:proper_f] status = 'invalid' status = proper != proper_f ? 'formatted' : 'unchanged' if proper && proper_f hsh[:proper_status] = status if status.present? hsh end |
#format_proper(string) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/crm_formatter/proper.rb', line 5 def format_proper(string) str_hsh = { proper_status: nil, proper: string, proper_f: nil } return str_hsh unless string.present? str_hsh[:proper_f] = CrmFormatter::Tools.new.letter_case_check(string) str_hsh = check_proper_status(str_hsh) end |