Class: PgDecorator::Injector
- Inherits:
-
Object
- Object
- PgDecorator::Injector
- Defined in:
- lib/pg_decorator/injector.rb
Class Method Summary collapse
Class Method Details
.inject(custom_app_name = 'Ruby pg app', custom_app_root = null) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/pg_decorator/injector.rb', line 3 def self.inject(custom_app_name='Ruby pg app', custom_app_root=null) custom_app_root ||= Dir.pwd require 'pg' unless defined?( PG ) require_relative 'decorator' PG::Connection.module_eval do define_method(:app_name) { custom_app_name } define_method(:app_root) { custom_app_root} include PgDecorator::Decorator end true end |