Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Use @options so method parameter can be named options

Also @options saves a method call.
  • Loading branch information...
commit 2fb65b3889ce727f61cc11826cf27914ff2e4044 1 parent 38f0848
@jnunemaker authored
Showing with 9 additions and 9 deletions.
  1. +9 −9 lib/adapter/cassanity.rb
View
18 lib/adapter/cassanity.rb
@@ -9,29 +9,29 @@ module Cassanity
def_delegator :@client, :schema
# Public
- def read(key, args = nil)
+ def read(key, options = nil)
operation_options = {where: where(key)}
- adapter_options = options[:read]
- arguments = update_arguments(operation_options, adapter_options, args)
+ adapter_options = @options[:read]
+ arguments = update_arguments(operation_options, adapter_options, options)
rows = client.select(arguments)
rows.empty? ? nil : decode(rows.first)
end
# Public
- def write(key, attributes, args = nil)
+ def write(key, attributes, options = nil)
operation_options = {set: encode(attributes), where: where(key)}
- adapter_options = options[:write]
- arguments = update_arguments(operation_options, adapter_options, args)
+ adapter_options = @options[:write]
+ arguments = update_arguments(operation_options, adapter_options, options)
client.update(arguments)
end
# Public
- def delete(key, args = nil)
+ def delete(key, options = nil)
operation_options = {where: where(key)}
- adapter_options = options[:delete]
- arguments = update_arguments(operation_options, adapter_options, args)
+ adapter_options = @options[:delete]
+ arguments = update_arguments(operation_options, adapter_options, options)
client.delete(arguments)
end
Please sign in to comment.
Something went wrong with that request. Please try again.