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.



61
62
63
64
65
# File 'lib/db/model/statement/predicate.rb', line 61

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

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



67
68
69
# File 'lib/db/model/statement/predicate.rb', line 67

def key
  @key
end

#operatorObject (readonly)

Returns the value of attribute operator.



68
69
70
# File 'lib/db/model/statement/predicate.rb', line 68

def operator
  @operator
end

#valueObject (readonly)

Returns the value of attribute value.



69
70
71
# File 'lib/db/model/statement/predicate.rb', line 69

def value
  @value
end

Instance Method Details

#append_to(statement) ⇒ Object



71
72
73
74
75
# File 'lib/db/model/statement/predicate.rb', line 71

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

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/db/model/statement/predicate.rb', line 77

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



81
82
83
# File 'lib/db/model/statement/predicate.rb', line 81

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