Advertisement
saasbook

mutations.rb

Jan 10th, 2012
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.22 KB | None | 0 0
  1. def my_swap(a,b)
  2.   b,a = a,b
  3. end
  4.  
  5. class Foo
  6. attr_accessor :a, :b
  7.   def my_swap_2()
  8.     @b,@a = @a,@b
  9.   end
  10. end
  11.  
  12. def my_string_replace_1(s)
  13.   s.gsub( /Hi/, 'Hello')
  14. end
  15.  
  16. def my_string_replace_2(s)
  17.   s.gsub!( /Hi/, 'Hello')
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement