forresty/rdkit

View on GitHub
example/counter/command_runner.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Counter
  class CommandRunner < RDKit::RESPRunner
    def initialize(counter)
      @counter = counter
    end

    # every public method of this class will be accessible by clients
    def count
      @counter.count
    end

    def incr(n=1)
      @counter.incr(n.to_i)
    end

    def add(*elements)
      @counter.add(elements.map(&:to_i))
    end
  end
end