Class: Expression

Inherits:
Object
  • Object
show all
Defined in:
lib/eno/expressions.rb

Constant Summary collapse

S_EQ =
'='
S_TILDE =
'~'
S_NEQ =
'<>'
S_LT =
'<'
S_GT =
'>'
S_LTE =
'<='
S_GTE =
'>='
S_AND =
'and'
S_OR =
'or'
S_PLUS =
'+'
S_MINUS =
'-'
S_MUL =
'*'
S_DIV =
'/'
S_MOD =
'%'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*members, **props) ⇒ Expression

Returns a new instance of Expression.



37
38
39
40
# File 'lib/eno/expressions.rb', line 37

def initialize(*members, **props)
  @members = members
  @props = props
end

Instance Attribute Details

#membersObject (readonly)

Returns the value of attribute members.



35
36
37
# File 'lib/eno/expressions.rb', line 35

def members
  @members
end

#propsObject (readonly)

Returns the value of attribute props.



35
36
37
# File 'lib/eno/expressions.rb', line 35

def props
  @props
end

Instance Method Details

#!=(expr2) ⇒ Object



81
82
83
# File 'lib/eno/expressions.rb', line 81

def !=(expr2)
  Operator.new(S_NEQ, self, expr2)
end

#!@Object

not



134
135
136
# File 'lib/eno/expressions.rb', line 134

def !@
  Not.new(self)
end

#%(expr2) ⇒ Object



125
126
127
# File 'lib/eno/expressions.rb', line 125

def %(expr2)
  Operator.new(S_MOD, self, expr2)
end

#&(expr2) ⇒ Object



101
102
103
# File 'lib/eno/expressions.rb', line 101

def &(expr2)
  Operator.new(S_AND, self, expr2)
end

#*(expr2) ⇒ Object



117
118
119
# File 'lib/eno/expressions.rb', line 117

def *(expr2)
  Operator.new(S_MUL, self, expr2)
end

#+(expr2) ⇒ Object



109
110
111
# File 'lib/eno/expressions.rb', line 109

def +(expr2)
  Operator.new(S_PLUS, self, expr2)
end

#-(expr2) ⇒ Object



113
114
115
# File 'lib/eno/expressions.rb', line 113

def -(expr2)
  Operator.new(S_MINUS, self, expr2)
end

#/(expr2) ⇒ Object



121
122
123
# File 'lib/eno/expressions.rb', line 121

def /(expr2)
  Operator.new(S_DIV, self, expr2)
end

#<(expr2) ⇒ Object



85
86
87
# File 'lib/eno/expressions.rb', line 85

def <(expr2)
  Operator.new(S_LT, self, expr2)
end

#<=(expr2) ⇒ Object



93
94
95
# File 'lib/eno/expressions.rb', line 93

def <=(expr2)
  Operator.new(S_LTE, self, expr2)
end

#==(expr2) ⇒ Object



73
74
75
# File 'lib/eno/expressions.rb', line 73

def ==(expr2)
  Operator.new(S_EQ, self, expr2)
end

#=~(expr2) ⇒ Object



77
78
79
# File 'lib/eno/expressions.rb', line 77

def =~(expr2)
  Operator.new(S_TILDE, self, expr2)
end

#>(expr2) ⇒ Object



89
90
91
# File 'lib/eno/expressions.rb', line 89

def >(expr2)
  Operator.new(S_GT, self, expr2)
end

#>=(expr2) ⇒ Object



97
98
99
# File 'lib/eno/expressions.rb', line 97

def >=(expr2)
  Operator.new(S_GTE, self, expr2)
end

#^(expr2) ⇒ Object



129
130
131
# File 'lib/eno/expressions.rb', line 129

def ^(expr2)
  CastShorthand.new(self, expr2)
end

#as(sym = nil, &block) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/eno/expressions.rb', line 42

def as(sym = nil, &block)
  if sym
    Alias.new(self, sym)
  else
    Alias.new(self, Query::Query.new(&block))
  end
end

#cast(sym) ⇒ Object



154
155
156
# File 'lib/eno/expressions.rb', line 154

def cast(sym)
  Cast.new(self, sym)
end

#descObject



50
51
52
# File 'lib/eno/expressions.rb', line 50

def desc
  Desc.new(self)
end

#in(*args) ⇒ Object



158
159
160
# File 'lib/eno/expressions.rb', line 158

def in(*args)
  In.new(self, *args)
end

#inner_join(sym, **props) ⇒ Object



150
151
152
# File 'lib/eno/expressions.rb', line 150

def inner_join(sym, **props)
  join(sym, props.merge(type: :inner))
end

#join(sym, **props) ⇒ Object



146
147
148
# File 'lib/eno/expressions.rb', line 146

def join(sym, **props)
  Join.new(self, sym, **props)
end

#not_in(*args) ⇒ Object



162
163
164
# File 'lib/eno/expressions.rb', line 162

def not_in(*args)
  NotIn.new(self, *args)
end

#not_null?Boolean

Returns:

  • (Boolean)


142
143
144
# File 'lib/eno/expressions.rb', line 142

def not_null?
  IsNotNull.new(self)
end

#null?Boolean

Returns:

  • (Boolean)


138
139
140
# File 'lib/eno/expressions.rb', line 138

def null?
  IsNull.new(self)
end

#over(sym = nil, &block) ⇒ Object



54
55
56
# File 'lib/eno/expressions.rb', line 54

def over(sym = nil, &block)
  Over.new(self, sym || WindowExpression.new(&block))
end

#|(expr2) ⇒ Object



105
106
107
# File 'lib/eno/expressions.rb', line 105

def |(expr2)
  Operator.new(S_OR, self, expr2)
end