Module: Aspect4r::Base::ClassMethods

Defined in:
lib/aspect4r/base.rb

Instance Method Summary collapse

Instance Method Details

#a4r_dataObject



27
28
29
# File 'lib/aspect4r/base.rb', line 27

def a4r_data
  @a4r_data ||= Aspect4r::Model::AspectData.new(self)
end

#a4r_disable_advices_temporarily(*methods) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/aspect4r/base.rb', line 40

def a4r_disable_advices_temporarily *methods
  methods.each do |method|
    advices = a4r_data[method.to_sym]
    next if advices.nil? or advices.empty?
    
    Aspect4r::Helper.define_method self, method, advices.wrapped_method
  end
  
  yield
ensure
  methods.each do |method|
    advices = a4r_data[method.to_sym]
    
    next if advices.nil? or advices.empty?
    
    Aspect4r::Helper.create_method self, method
  end
end

#a4r_groupObject



31
32
33
34
35
36
37
38
# File 'lib/aspect4r/base.rb', line 31

def a4r_group
  a4r_data.change_group
  
  if block_given?
    yield
    a4r_data.change_group
  end
end