Class: SdbDal::EqualsCondition

Inherits:
Object
  • Object
show all
Defined in:
lib/sdb_dal/equals_condition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attribute_description, value) ⇒ EqualsCondition

Returns a new instance of EqualsCondition.



7
8
9
10
# File 'lib/sdb_dal/equals_condition.rb', line 7

def initialize(attribute_description,value)
  self.attribute_description=attribute_description
  self.value=value
end

Instance Attribute Details

#attribute_descriptionObject

Returns the value of attribute attribute_description.



5
6
7
# File 'lib/sdb_dal/equals_condition.rb', line 5

def attribute_description
  @attribute_description
end

#valueObject

Returns the value of attribute value.



6
7
8
# File 'lib/sdb_dal/equals_condition.rb', line 6

def value
  @value
end

Instance Method Details

#matches?(domain_object) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/sdb_dal/equals_condition.rb', line 11

def matches?(domain_object)
    return domain_object[attribute_description.name]==value
end

#to_sdb_queryObject



14
15
16
# File 'lib/sdb_dal/equals_condition.rb', line 14

def to_sdb_query
  return "'#{self.attribute_description.name}'='#{self.attribute_description.format_for_sdb(self.value)}'"
end