Class: QueryBuilder::Core::Clause Abstract

Inherits:
Base
  • Object
show all
Includes:
Comparable
Defined in:
lib/query_builder/core/clause.rb

Overview

This class is abstract.

The base class for all AST clauses (parts of statement)

Every clause has a type, allowing to filter clauses of a statement.

Direct Known Subclasses

QueryBuilder::CQL::Modifiers::Base

Instance Attribute Summary

Attributes inherited from Base

#attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#attribute, attribute, attributes, inherited, #initialize, #to_s

Constructor Details

This class inherits a constructor from QueryBuilder::Core::Base

Class Method Details

.type(value = nil) ⇒ Symbol?

Gets/sets type for the specific clause class

Parameters:

  • value (#to_sym, nil) (defaults to: nil)

Returns:

  • (Symbol, nil)


32
33
34
# File 'lib/query_builder/core/clause.rb', line 32

def self.type(value = nil)
  value ? (@type = value) : @type
end

.uniqueundefined

Makes all instances of the class unique

Only one instance can be added to the statement via ‘Statement#<<` method

Returns:

  • (undefined)


22
23
24
# File 'lib/query_builder/core/clause.rb', line 22

def self.unique
  include Equalizer.new(:class)
end

Instance Method Details

#typeSymbol

Returns The type of the clause.

Returns:

  • (Symbol)

    The type of the clause



40
41
42
# File 'lib/query_builder/core/clause.rb', line 40

def type
  self.class.type
end