mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* golf_prelude.rb (Object.quine): get the script itself.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									f1ddd69d7b
								
							
						
					
					
						commit
						ec12be8574
					
				
					 2 changed files with 10 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -1,3 +1,5 @@
 | 
			
		|||
SCRIPT_LINES__={}
 | 
			
		||||
 | 
			
		||||
class Object
 | 
			
		||||
  def method_missing m, *a, &b
 | 
			
		||||
    r = /^#{m}/
 | 
			
		||||
| 
						 | 
				
			
			@ -14,6 +16,10 @@ class Object
 | 
			
		|||
  def h(a='H', b='w', c='!')
 | 
			
		||||
    puts "#{a}ello, #{b}orld#{c}"
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def quine(src = $0)
 | 
			
		||||
    SCRIPT_LINES__[src]
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
class Integer
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue