Guest User

Untitled

a guest
Nov 23rd, 2012
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.28 KB | None | 0 0
  1. def write_file(data)
  2.   # do something
  3. end
  4.  
  5. def read_file
  6.   # do something
  7. end
  8.  
  9. def file_operation(operation, data = [])
  10.  # operation is either :write or :read
  11.  func_name = "#{operation.to_s}_file"
  12.  
  13.   args = [func_name]
  14.   args << data if operation == :write  
  15.  send(args)
  16.  
  17. end
Advertisement
Add Comment
Please, Sign In to add comment