Sha256: a599613c103dc11576dc60319fce20e9efb545c7088173eecc450699c0212af1

Contents?: true

Size: 958 Bytes

Versions: 4

Compression:

Stored size: 958 Bytes

Contents

# encoding: utf-8

module QueryBuilder::CQL

  module Modifiers

    # Provides (NO)SUPERUSER clauses for statements
    #
    module Superuser

      # Adds (NO)SUPERUSER clause to the statement
      #
      # @param [Boolean] option (true)
      #
      # @return [QueryBuilder::Core::Statement] updated statement
      #
      def superuser(option = true)
        self << Clause.new(reverse: !option)
      end

      private

      def maybe_superuser
        clauses(:superuser)
      end

      # The clause for adding to a statement
      #
      # @api private
      #
      class Clause < Base

        unique
        type :superuser
        attribute :reverse, default: false

        # @private
        def to_s
          "#{maybe_no}SUPERUSER"
        end

        private

        def maybe_no
          "NO" if reverse
        end

      end # class Clause

    end # module Superuser

  end # module Modifiers

end # module QueryBuilder::CQL

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
query_builder-0.0.4 lib/query_builder/cql/modifiers/superuser.rb
query_builder-0.0.3 lib/query_builder/cql/modifiers/superuser.rb
query_builder-0.0.2 lib/query_builder/cql/modifiers/superuser.rb
query_builder-0.0.1 lib/query_builder/cql/modifiers/superuser.rb