Module: RakeCommander::Patcher::Base::ClassMethods

Defined in:
lib/rake-commander/patcher/base.rb

Instance Method Summary collapse

Instance Method Details

#any_patch_method?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/rake-commander/patcher/base.rb', line 27

def any_patch_method?
  patch_prepend? || patch_include? || patch_extend?
end

#included(base) ⇒ Object



14
15
16
17
18
# File 'lib/rake-commander/patcher/base.rb', line 14

def included(base)
  super(base)
  base.extend self::ClassMethods if defined?(self::ClassMethods)
  invoke_patch_methods!(base) unless self == RakeCommander::Patcher::Base
end

#invoke_patch_methods!(base) ⇒ Object



20
21
22
23
24
25
# File 'lib/rake-commander/patcher/base.rb', line 20

def invoke_patch_methods!(base)
  raise "#{self}: no patch methods. Patching with include requires at least one." unless any_patch_method?
  patch_prepend(base) if patch_prepend?
  patch_include(base) if patch_include?
  patch_extend(base)  if patch_extend?
end

#patch_extend?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/rake-commander/patcher/base.rb', line 39

def patch_extend?
  respond_to?(:patch_extend)
end

#patch_include?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/rake-commander/patcher/base.rb', line 35

def patch_include?
  respond_to?(:patch_include)
end

#patch_prepend?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/rake-commander/patcher/base.rb', line 31

def patch_prepend?
  respond_to?(:patch_prepend)
end