This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
include Aspect4r | |
def test value | |
puts 'test' | |
value | |
end | |
around :test do |proxy, value| | |
puts 'around 1' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
include Aspect4r | |
before :test, :validate | |
after :test, :handle_result | |
def test value | |
value | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
include Aspect4r | |
before :test, :method_name_arg => true do |method, value| | |
puts "Entering #{method}(#{value.inspect})" | |
end | |
after :test, :method_name_arg => true do |method, result, value| | |
puts "Exiting from #{method} with result #{result.inspect}." | |
result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
include Aspect4r::Classic | |
a4r_around :test do |proxy, value| | |
end | |
a4r_before_filter :test do |value| | |
end | |
a4r_before :test do |value| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
class << self | |
include Aspect4r | |
before :test do |input| | |
puts 'before test' | |
end | |
after :test do |result, input| | |
puts 'after test' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it "around advice" do | |
advice = Klass.a4r_data[:test][0] | |
advice.around?.should be_true | |
o = Klass.new | |
o.expects(:a4r_invoke).with(:proxy, 1) | |
advice.invoke(o, :proxy, 1) | |
o.value.should == %w(around(before) around(after)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before :test do | |
puts 'before 1' | |
end | |
around :test do |proxy| | |
puts 'around(before)' | |
result = a4r_invoke proxy | |
puts 'around(after)' | |
result | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before :test do | |
puts 'before 1' | |
end | |
a4r_group do | |
before :test do | |
puts 'before 2' | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
around :test do |proxy| | |
puts 'around 1 (before)' | |
result = a4r_invoke proxy | |
puts 'around 1 (after)' | |
result | |
end | |
before :test do | |
puts 'before' | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "\342\224\214\342\224\254\342\224\220" | |
puts "\342\224\234\342\224\274\342\224\244" | |
puts "\342\224\224\342\224\264\342\224\230" | |
# === OUTPUT === | |
#┌┬┐ | |
#├┼┤ | |
#└┴┘ | |
puts "\342\224\214\342\224\200\342\224\220" |
OlderNewer