Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Clean up etc

  • Loading branch information...
commit eec3ea263b720207da6cdd9192ce3fd39dd2ad05 1 parent be3fab1
@gcao authored
View
3  .irbrc
@@ -0,0 +1,3 @@
+$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
+
+require 'aspector'
View
10 lib/aspector/advice_metadata.rb
@@ -2,16 +2,16 @@ module Aspector
class AdviceMetadata
attr_reader :advice_type, :default_options, :mandatory_options
- def initialize advice_type, default_options = {}, mandatory_options = {}
+ def initialize advice_type, default_options, mandatory_options
@advice_type = advice_type
@default_options = default_options || {}
@mandatory_options = mandatory_options || {}
end
- BEFORE = new Aspector::Advice::BEFORE, { :new_methods_only => true }, :skip_if_false => false
- BEFORE_FILTER = new Aspector::Advice::BEFORE, { :new_methods_only => true }, :skip_if_false => true
- AFTER = new Aspector::Advice::AFTER, { :new_methods_only => true, :result_arg => true }
- AROUND = new Aspector::Advice::AROUND, { :new_methods_only => true }
+ BEFORE = new Aspector::Advice::BEFORE, nil, :skip_if_false => false
+ BEFORE_FILTER = new Aspector::Advice::BEFORE, nil, :skip_if_false => true
+ AFTER = new Aspector::Advice::AFTER, { :result_arg => true }, nil
+ AROUND = new Aspector::Advice::AROUND, nil, nil
end
end
View
3  lib/aspector/aspect.rb
@@ -40,7 +40,8 @@ def target code
end
def to_hash
- { "type" => self.class.name,
+ {
+ "type" => self.class.name,
"options" => @options,
"advices" => @advices.map {|advice| advice.to_s }
}
View
7 lib/aspector/aspect_instance.rb
@@ -87,17 +87,14 @@ def apply_to_method method
end
def to_hash
- { "type" => self.class.name,
+ {
+ "type" => self.class.name,
"context" => @context.name,
"options" => @options,
"aspect" => @aspect.to_hash
}
end
- def to_s
- to_hash.inspect
- end
-
private
def get_context
View
2  lib/aspector/module_extension.rb
@@ -29,7 +29,7 @@ def singleton_method_added_aspector method
aspect_instances = eigen_class.instance_variable_get(:@aspect_instances)
return yield(method) if aspect_instances.nil? or aspect_instances.empty?
- aspects_applied_flag = :"@singleton_aspects_applied_#{method}"
+ aspects_applied_flag = :"@aspects_applied_#{method}"
return yield(method) if eigen_class.instance_variable_get(aspects_applied_flag)
begin
Please sign in to comment.
Something went wrong with that request. Please try again.