Module: Flucti::Utilities::CoreExt

Defined in:
lib/flucti/utilities/core_ext.rb

Class Method Summary collapse

Class Method Details

.apply!Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/flucti/utilities/core_ext.rb', line 4

def self.apply!
  # Proper version of #constantize, since ActiveSupport's behaves strangely.
  String.class_eval do
    def constantize
      split('::').inject(Object) { |mod, name| mod.const_get(name) }
    end
  end

  Pathname.class_eval do
    alias_method :/, :+
    protected :+
  end

  # Thorough version of `unhook!'.
  ActiveSupport::Dependencies.unhook!
  ActiveSupport::Dependencies::ClassConstMissing.module_eval do
    def const_missing(*args)
      super
    end
  end
  
  ActiveSupport::Inflector.inflections do |inflect|
    inflect.singular('databases', 'database')
  end

  WebService::RemoteCollection.class_eval do
    include ConnectionErrorHandling
  end
end