Guest User

Ruby_send_method

a guest
Jun 8th, 2013
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #!/usr/bin/ruby
  2.  
  3. class Rubyist
  4. attr_accessor :hello
  5.  
  6. def say_hello(*names)
  7. names.each do |name|
  8. self.send(:hello, name)
  9. end
  10. end
  11. end
  12.  
  13. all_names = ["dhaval", "joshi"]
  14.  
  15. ruby = Rubyist.new
  16. ruby.say_hello(all_names)
  17.  
  18. put ruby.inspect
Advertisement
Add Comment
Please, Sign In to add comment