Module: BindingNinja

Defined in:
lib/binding_ninja.rb,
lib/binding_ninja/version.rb,
ext/binding_ninja/binding_ninja.c

Constant Summary collapse

METHOD_DEFINER =
->(klass) do
  unless klass.method_defined?(:auto_inject_binding_options)
    options = {}
    klass.class_eval do
      @auto_inject_binding_options = options
    end

    klass.define_singleton_method(:auto_inject_binding_options) do
      super().merge(options)
    end
  end
end
VERSION =
"0.2.3"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(klass) ⇒ Object


38
39
40
# File 'lib/binding_ninja.rb', line 38

def self.extended(klass)
  METHOD_DEFINER.call(klass)
end

Instance Method Details

#auto_inject_binding_optionsObject


11
12
13
# File 'lib/binding_ninja.rb', line 11

def auto_inject_binding_options
  {}
end

#included(klass) ⇒ Object


33
34
35
36
# File 'lib/binding_ninja.rb', line 33

def included(klass)
  super
  METHOD_DEFINER.call(klass)
end

#inherited(klass) ⇒ Object


28
29
30
31
# File 'lib/binding_ninja.rb', line 28

def inherited(klass)
  super
  METHOD_DEFINER.call(klass)
end