Advertisement
Guest User

Untitled

a guest
Mar 9th, 2012
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class VersionBlock
  2.   attr_accessor :version_major,
  3.                 :version_minor,
  4.                 :revision_num,
  5.                 :author_info,
  6.                 :website_loc
  7.  
  8.   def initialize parent
  9.     @parent = parent
  10.   end    
  11. end
  12.  
  13. class AddIn
  14.   def initialize name, *version, &block    
  15.     if block_given?
  16.       @parent = eval "self", block.binding
  17.       @VersionInfo = VersionBlock.new @parent
  18.                
  19.       instance_eval &block
  20.       puts version_block.version_major
  21.     end
  22.   end
  23.  
  24.   private
  25.  
  26.   def version_block
  27.     VersionBlock.new self
  28.   end
  29.  
  30. end
  31.  
  32. AddIn.new "Microsoft OLE helper for Windows", :X, :Y do
  33.   def proc
  34.     puts "Hi, there!"
  35.   end
  36.    
  37.   version_block do
  38.     version_major 1
  39.     version_minor 0
  40.     revision_num 0
  41.        
  42.     author_info "", ""
  43.     website     ""
  44.   end
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement