Module: Innate::Helper::Aspect::SingletonMethods

Includes:
Traited
Defined in:
lib/innate/helper/aspect.rb

Instance Method Summary collapse

Methods included from Traited

#ancestral_trait, #ancestral_trait_values, #class_trait, #each_ancestral_trait, included, #trait

Instance Method Details

#add_action_wrapper(order, method_name) ⇒ Object



115
116
117
118
119
120
121
# File 'lib/innate/helper/aspect.rb', line 115

def add_action_wrapper(order, method_name)
  if wrap = trait[:wrap]
    wrap.merge(SortedSet[[order, method_name.to_s]])
  else
    trait :wrap => SortedSet[[order, method_name.to_s]]
  end
end

#after(*names, &block) ⇒ Object



106
107
108
# File 'lib/innate/helper/aspect.rb', line 106

def after(*names, &block)
  names.each{|name| AOP[self][:after][name] = block }
end

#after_all(&block) ⇒ Object



102
103
104
# File 'lib/innate/helper/aspect.rb', line 102

def after_all(&block)
  AOP[self][:after_all] = block
end

#before(*names, &block) ⇒ Object



98
99
100
# File 'lib/innate/helper/aspect.rb', line 98

def before(*names, &block)
  names.each{|name| AOP[self][:before][name] = block }
end

#before_all(&block) ⇒ Object



94
95
96
# File 'lib/innate/helper/aspect.rb', line 94

def before_all(&block)
  AOP[self][:before_all] = block
end

#wrap(*names, &block) ⇒ Object



110
111
112
113
# File 'lib/innate/helper/aspect.rb', line 110

def wrap(*names, &block)
  before(*names, &block)
  after(*names, &block)
end