Class: Jets::Inflections

Inherits:
Object
  • Object
show all
Defined in:
lib/jets/inflections.rb

Class Method Summary collapse

Class Method Details

.baseObject

base custom inflections



18
19
20
21
22
23
# File 'lib/jets/inflections.rb', line 18

def base
  {
    sns: 'sns',
    sqs: 'sqs'
  }
end

.customObject

User defined custom inflections



26
27
28
29
# File 'lib/jets/inflections.rb', line 26

def custom
  path = "#{Jets.root}config/inflections.yml"
  File.exist?(path) ? YAML.load_file(path) : {}
end

.load(inflect, inflections) ⇒ Object



11
12
13
14
15
# File 'lib/jets/inflections.rb', line 11

def load(inflect, inflections)
  inflections.each do |k,v|
    inflect.irregular k,v
  end
end

.load!Object



4
5
6
7
8
9
# File 'lib/jets/inflections.rb', line 4

def load!
  ActiveSupport::Inflector.inflections(:en) do |inflect|
    load(inflect, base)
    load(inflect, custom)
  end
end