Class: UnaryOperation

Inherits:
Expr
  • Object
show all
Defined in:
lib/lilit_sql.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Expr

#*, #+, #<, #<=, #>, #>=, #and, #asc, #desc, #eq, #in, #minus, #ne, #not, #plus

Constructor Details

#initialize(op, value) ⇒ UnaryOperation

Returns a new instance of UnaryOperation.



89
90
91
92
# File 'lib/lilit_sql.rb', line 89

def initialize(op, value)
  @op = op
  @value = value
end

Instance Attribute Details

#opObject

Returns the value of attribute op.



87
88
89
# File 'lib/lilit_sql.rb', line 87

def op
  @op
end

Instance Method Details

#==(other) ⇒ Object



98
99
100
# File 'lib/lilit_sql.rb', line 98

def ==(other)
  other.class == self.class && other.state == state
end

#ref_sqlObject



94
95
96
# File 'lib/lilit_sql.rb', line 94

def ref_sql
  "#{@op} (#{@value.ref_sql})"
end

#stateObject



102
103
104
# File 'lib/lilit_sql.rb', line 102

def state
  instance_variables.map { |variable| instance_variable_get variable }
end