Module: Postmark::Inflector
Instance Method Summary collapse
Instance Method Details
#camel_case_regexp ⇒ Object
14 15 16 |
# File 'lib/postmark/inflector.rb', line 14 def camel_case_regexp /(?:[A-Z](?:(?:[A-Z]+(?![a-z\d]))|[a-z\d]*))|[a-z\d\_]+/ end |
#to_postmark(name) ⇒ Object
6 7 8 |
# File 'lib/postmark/inflector.rb', line 6 def to_postmark(name) name.to_s.split('_').map { |part| capitalize_first_letter(part) }.join('') end |
#to_ruby(name) ⇒ Object
10 11 12 |
# File 'lib/postmark/inflector.rb', line 10 def to_ruby(name) name.to_s.scan(camel_case_regexp).join('_').downcase.to_sym end |