Class: Nyanko::Unit::Extender::Extension

Inherits:
Module
  • Object
show all
Includes:
ActiveRecordClassMethods
Defined in:
lib/nyanko/unit/extender/extension.rb

Instance Method Summary collapse

Methods included from ActiveRecordClassMethods

#scope

Constructor Details

#initialize(mod, prefix = nil, &block) ⇒ Extension

Returns a new instance of Extension.



7
8
9
10
11
12
# File 'lib/nyanko/unit/extender/extension.rb', line 7

def initialize(mod, prefix = nil, &block)
  @mod    = mod
  @prefix = prefix
  @block  = block
  define_methods_with_prefix(instance_methods_module, &block)
end

Instance Method Details

#class_methods(&block) ⇒ Object



14
15
16
# File 'lib/nyanko/unit/extender/extension.rb', line 14

def class_methods(&block)
  define_methods_with_prefix(class_methods_module, &block)
end

#class_methods_moduleObject



22
23
24
# File 'lib/nyanko/unit/extender/extension.rb', line 22

def class_methods_module
  @class_methods_module ||= Module.new
end

#instance_methods_moduleObject



18
19
20
# File 'lib/nyanko/unit/extender/extension.rb', line 18

def instance_methods_module
  self
end