Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Do not use require_relative because it is not built in to Ruby

  • Loading branch information...
commit 855308cd071032e5bcd67ef7530129fe5b04fc51 1 parent a6e2bd1
@gcao authored
View
4 examples/activerecord_hooks.rb
@@ -8,7 +8,9 @@ def save
##############################
-require_relative '../lib/aspector'
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+
+require 'aspector'
class ActiveRecordHooks < Aspector::Base
logger.level = Aspector::Logging::TRACE
View
4 examples/around_example.rb
@@ -8,7 +8,9 @@ def test
##############################
-require_relative '../lib/aspector'
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+
+require 'aspector'
aspector(A) do
target do
View
4 examples/aspector_apply_example.rb
@@ -6,7 +6,9 @@ def test
##############################
-require_relative '../lib/aspector'
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+
+require 'aspector'
aspect = Aspector do
target do
View
4 examples/aspector_example.rb
@@ -6,7 +6,9 @@ def test
##############################
-require_relative '../lib/aspector'
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+
+require 'aspector'
aspector(A) do
target do
View
4 examples/cache_aspect.rb
@@ -39,7 +39,9 @@ def self.cache key, ttl
##############################
-require_relative '../lib/aspector'
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+
+require 'aspector'
class CacheAspect < Aspector::Base
default :ttl => 60
View
4 examples/design_by_contract.rb
@@ -21,7 +21,9 @@ def sell price
##############################
-require_relative '../lib/aspector'
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+
+require 'aspector'
class Object
def assert bool, message = 'Assertion failure'
View
4 examples/exception_handler.rb
@@ -8,7 +8,9 @@ def test input
##############################
-require_relative '../lib/aspector'
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+
+require 'aspector'
class ExceptionHandler < Aspector::Base
View
6 examples/exception_handler2.rb
@@ -12,11 +12,13 @@ def test input
##############################
-require_relative '../lib/aspector'
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+
+require 'aspector'
class ExceptionHandler < Aspector::Base
- module ToBeIncluded
+ target do
def handle_exception proxy, *args, &block
proxy.call *args, &block
rescue => e
View
4 examples/implicit_method_option_test.rb
@@ -6,7 +6,9 @@ def test
##############################
-require_relative '../lib/aspector'
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+
+require 'aspector'
class ImplicitMethodOptionTest < Aspector::Base
# Apply advice to options[:method] and options[:methods] if no target method is given
View
4 examples/logging_aspect.rb
@@ -8,7 +8,9 @@ def test input
##############################
-require_relative '../lib/aspector'
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+
+require 'aspector'
class LoggingAspect < Aspector::Base
View
6 examples/retry_aspect.rb
@@ -9,11 +9,13 @@ def test
##############################
-require_relative '../lib/aspector'
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+
+require 'aspector'
class RetryAspect < Aspector::Base
- module ToBeIncluded
+ target do
def retry_this proxy, &block
proxy.call &block
rescue => e
View
24 lib/aspector.rb
@@ -1,16 +1,16 @@
-require_relative 'aspector/logging'
-require_relative 'aspector/logger'
+require 'aspector/logging'
+require 'aspector/logger'
-require_relative 'aspector/object_extension'
-require_relative 'aspector/module_extension'
+require 'aspector/object_extension'
+require 'aspector/module_extension'
-require_relative 'aspector/base'
-require_relative 'aspector/base_class_methods'
-require_relative 'aspector/advice'
-require_relative 'aspector/advice_metadata'
-require_relative 'aspector/method_matcher'
-require_relative 'aspector/deferred_logic'
-require_relative 'aspector/deferred_option'
+require 'aspector/base'
+require 'aspector/base_class_methods'
+require 'aspector/advice'
+require 'aspector/advice_metadata'
+require 'aspector/method_matcher'
+require 'aspector/deferred_logic'
+require 'aspector/deferred_option'
-require_relative 'aspector/aspect_instances'
+require 'aspector/aspect_instances'
Please sign in to comment.
Something went wrong with that request. Please try again.