Module: Before

Included in:
VCAP::Services::Base::Provisioner
Defined in:
lib/base/simple_aop.rb

Overview

Copyright © 2009-2012 VMware, Inc. Simple before filter to instance methods. We can chain filters to multiple methods. Filter method can return nil or raise error to terminater the evoke chain.

Example: Class MyClass

include Before

def f1(msg) puts msg end

def f2
  puts "f2"
end

def before_filter
  puts "before"

  true  # return true to proceed
end

# use before method after methods are defined
before [:f1, :f2], :before_filter

end

c = MyClass.new c.f1(“hello”) c.f2

>

before hello before f2

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



35
36
37
# File 'lib/base/simple_aop.rb', line 35

def self.included(base)
  base.extend ClassMethods
end