Module: GorillaPatch::Inflections
- Defined in:
- lib/gorilla_patch/inflections.rb
Overview
Inflections
Class Method Summary collapse
Class Method Details
.acronyms ⇒ Object
7 8 9 |
# File 'lib/gorilla_patch/inflections.rb', line 7 def acronyms @acronyms ||= %w[API HTML XML JSON SSL ID IP HTTP HTTPS DateTime] end |
.acronyms_regex ⇒ Object
11 12 13 |
# File 'lib/gorilla_patch/inflections.rb', line 11 def acronyms_regex /(?:(?<=([A-Z\d_]))|\b)((?i)#{acronyms.join('|')})(?=\b|[^a-z])/ end |
.from_inflecto ⇒ Object
63 64 65 66 67 |
# File 'lib/gorilla_patch/inflections.rb', line 63 def self.from_inflecto require 'inflecto-refinements' Inflecto::Refinements end |
.from_sequel ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/gorilla_patch/inflections.rb', line 49 def self.from_sequel @from_sequel ||= Module.new do require 'sequel' refine String do Sequel::Inflections.private_instance_methods.each do |method| define_method method do Sequel::Inflections.instance_method(method).bind(self).call(self) end end end end end |