Class: QueryBuilder::Core::Clause Abstract
- 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
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.type(value = nil) ⇒ Symbol?
Gets/sets type for the specific clause class.
-
.unique ⇒ undefined
Makes all instances of the class unique.
Instance Method Summary collapse
-
#type ⇒ Symbol
The type of the clause.
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
32 33 34 |
# File 'lib/query_builder/core/clause.rb', line 32 def self.type(value = nil) value ? (@type = value) : @type end |
.unique ⇒ undefined
Makes all instances of the class unique
Only one instance can be added to the statement via ‘Statement#<<` method
22 23 24 |
# File 'lib/query_builder/core/clause.rb', line 22 def self.unique include Equalizer.new(:class) end |
Instance Method Details
#type ⇒ Symbol
Returns The type of the clause.
40 41 42 |
# File 'lib/query_builder/core/clause.rb', line 40 def type self.class.type end |