Skip to content

vs4vijay/rubytrickz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rubytrickz

rubytrickz

Codebase

#!/usr/bin/ruby
class Rubytrickz

  attr_accessor :count  

  count = 1
  puts "My PID is #{Process.pid}"
  puts DATA.read
  puts

  def initialize
    count = 1
  end

  @here_doc = <<-MYDOC
    This is here doc, You can put any text/paragraph
  MYDOC

  puts "Here Doc : #@here_doc"
  
  trap(:INT) {
    puts "This is Interrupt handler, It will execute on Ctrl+C"
    exit if (count += 1) > 3
  }

  at_exit {
    puts "This is Exit hook, It will run on exit."
  }

  loop do
    # Infinite loop
  end

end

__END__
You can put any text here, It will not interpreted by Ruby

Releases

No releases published

Packages

No packages published

Languages