Permalink
Browse files

Cosmetic changes

  • Loading branch information...
1 parent f901dde commit 69a7c4a3a9d2eb99132d09bfcdd8ddf3c9362a87 @gcao committed Dec 31, 2012
Showing with 22 additions and 3 deletions.
  1. +15 −0 examples/block_exp.rb
  2. +1 −1 lib/aspector/base_class_methods.rb
  3. +6 −2 lib/aspector/deferred_option.rb
View
@@ -0,0 +1,15 @@
+class A
+ def self.def_m &block
+ define_method :m do |*args|
+ block.call self, *args
+ end
+ end
+end
+
+A.def_m do |this, *args|
+ p this
+ p *args
+end
+
+A.new.m 100
+
@@ -110,7 +110,7 @@ def aop_raw *methods, &block
alias raw aop_raw
def aop_target code = nil, &block
- return unless code or block_given?
+ raise ArgumentError.new('No code or block is passed.') unless code or block_given?
logic = DeferredLogic.new(code || block)
aop_deferred_logics << logic
@@ -8,8 +8,12 @@ def [] key
self
end
- def inspect
- "options[:#{key}]"
+ def to_s
+ if key
+ "options[#{key.inspect}]"
+ else
+ "options[?]"
+ end
end
end
end

0 comments on commit 69a7c4a

Please sign in to comment.