Class: Redis::CommandOptions
- Inherits:
-
Object
- Object
- Redis::CommandOptions
- Defined in:
- lib/redis.rb
Instance Method Summary collapse
- #bool(name) ⇒ Object
-
#initialize(options) {|_self| ... } ⇒ CommandOptions
constructor
A new instance of CommandOptions.
- #insert(name) ⇒ Object
- #multi(name) ⇒ Object
- #splat(name) ⇒ Object
- #to_a ⇒ Object
- #value(name) ⇒ Object
- #words(name) ⇒ Object
Constructor Details
#initialize(options) {|_self| ... } ⇒ CommandOptions
Returns a new instance of CommandOptions.
519 520 521 522 523 |
# File 'lib/redis.rb', line 519 def initialize() @result = [] @options = yield(self) end |
Instance Method Details
#bool(name) ⇒ Object
525 526 527 |
# File 'lib/redis.rb', line 525 def bool(name) insert(name) { |argument, value| [argument] } end |
#insert(name) ⇒ Object
549 550 551 |
# File 'lib/redis.rb', line 549 def insert(name) @result += yield(name.to_s.upcase.gsub("_", ""), @options[name]) if @options[name] end |
#multi(name) ⇒ Object
537 538 539 |
# File 'lib/redis.rb', line 537 def multi(name) insert(name) { |argument, value| [argument].product(Array(value)).flatten } end |
#splat(name) ⇒ Object
533 534 535 |
# File 'lib/redis.rb', line 533 def splat(name) insert(name) { |argument, value| [argument, *value] } end |
#to_a ⇒ Object
545 546 547 |
# File 'lib/redis.rb', line 545 def to_a @result end |
#value(name) ⇒ Object
529 530 531 |
# File 'lib/redis.rb', line 529 def value(name) insert(name) { |argument, value| [argument, value] } end |
#words(name) ⇒ Object
541 542 543 |
# File 'lib/redis.rb', line 541 def words(name) insert(name) { |argument, value| value.split(" ") } end |