Sha256: 59f2566e2c93ff3ecdca38358224473901cd771c1ba255d4a38cc4c6b738cc95

Contents?: true

Size: 1.57 KB

Versions: 4

Compression:

Stored size: 1.57 KB

Contents

module Riak
  class Client
    # @private
    class BeefcakeProtobuffsBackend
      class RpbIndexReq
        module IndexQueryType
          EQ = 0
          RANGE = 1
        end
      end

      class RpbBucketProps
        def clean_hook(newval)
          if newval.is_a? Array
            return newval.map{|v| clean_hook v}
          end

          newval = newval.symbolize_keys if newval.is_a? Hash
          if newval.is_a?(Hash) && newval[:module] && newval[:function]
            modfun = RpbModFun.new newval
            hook = RpbCommitHook.new modfun: modfun
            newval = hook
          elsif newval.is_a?(Hash) && newval[:name]
            hook = RpbCommitHook.new newval
            newval = hook
          elsif newval.is_a? String
            hook = RpbCommitHook.new name: newval
            newval = hook
          end

          return newval
        end

        # "repeated" elements with zero items are indistinguishable
        # from a nil, so we have to manage has_precommit/has_postcommit
        # flags.
        def precommit=(newval)
          newval = clean_hook newval
          @precommit = newval
          @has_precommit = !!newval
        end

        def has_precommit=(newval)
          @has_precommit = newval
          @precommit ||= [] if newval
        end

        def postcommit=(newval)
          newval = clean_hook newval
          @postcommit = newval
          @has_postcommit = !!newval
        end

        def has_postcommit=(newval)
          @has_postcommit = newval
          @postcommit ||= [] if newval
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
riak-client-2.1.0 lib/riak/client/beefcake/message_overlay.rb
riak-client-2.0.0 lib/riak/client/beefcake/message_overlay.rb
riak-client-2.0.0.rc2 lib/riak/client/beefcake/message_overlay.rb
riak-client-2.0.0.rc1 lib/riak/client/beefcake/message_overlay.rb