Advertisement
robert_

AddInSample.rb

Mar 9th, 2012
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.54 KB | None | 0 0
  1. class AddIn
  2.     def initialize name, *version, &block
  3.  
  4.         @outside = self
  5.         if block_given?
  6.             if block.arity==1
  7.                 yield self
  8.             else
  9.                 instance_eval &block
  10.             end
  11.         end
  12.        
  13.         @version = block.call :VersionInfo
  14.         puts @version.inspect
  15.  
  16.         puts block.inspect
  17.     end
  18.  
  19.     def method_missing
  20.         # ...
  21.     end
  22.  
  23. private
  24.     @outside = nil
  25. end
  26. AddIn.new "api.xyzzy.helper".to_s, :X, :Y do
  27.     def VersionInfo
  28.         []
  29.     end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement