Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def write_file(data)
- # do something
- end
- def read_file
- # do something
- end
- def file_operation(operation, data = [])
- # operation is either :write or :read
- func_name = "#{operation.to_s}_file"
- args = [func_name]
- args << data if operation == :write
- send(args)
- end
Advertisement
Add Comment
Please, Sign In to add comment