Class: DB::Model::Statement::Predicate::Binary

Inherits:
Object
  • Object
show all
Defined in:
lib/db/model/statement/predicate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, operator, value) ⇒ Binary

Returns a new instance of Binary.



78
79
80
81
82
# File 'lib/db/model/statement/predicate.rb', line 78

def initialize(key, operator, value)
	@key = key
	@operator = operator
	@value = value
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



84
85
86
# File 'lib/db/model/statement/predicate.rb', line 84

def key
  @key
end

#operatorObject (readonly)

Returns the value of attribute operator.



85
86
87
# File 'lib/db/model/statement/predicate.rb', line 85

def operator
  @operator
end

#valueObject (readonly)

Returns the value of attribute value.



86
87
88
# File 'lib/db/model/statement/predicate.rb', line 86

def value
  @value
end

Instance Method Details

#append_to(statement) ⇒ Object



88
89
90
91
92
# File 'lib/db/model/statement/predicate.rb', line 88

def append_to(statement)
	@key.append_to(statement)
	statement.clause(@operator)
	@value.append_to(statement)
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


94
95
96
# File 'lib/db/model/statement/predicate.rb', line 94

def eql?(other)
	self.class.eql?(other.class) && self.key.eql?(other.key) && self.operator.eql?(other.operator) && self.value.eql?(other.value)
end

#hashObject



98
99
100
# File 'lib/db/model/statement/predicate.rb', line 98

def hash
	[self.class, @key, @operator, @value].hash
end