Class: Dbee::Model::Constraints::Static
- Defined in:
- lib/dbee/model/constraints/static.rb
Overview
A static constraint is a equality constraint on a child column to a static value. It is usually used in conjunction with a ReferenceConstraint, further giving it more scoping.
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from Base
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(name:, value: nil) ⇒ Static
constructor
A new instance of Static.
Constructor Details
#initialize(name:, value: nil) ⇒ Static
Returns a new instance of Static.
21 22 23 24 25 26 27 |
# File 'lib/dbee/model/constraints/static.rb', line 21 def initialize(name:, value: nil) super(name: name) @value = value freeze end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
19 20 21 |
# File 'lib/dbee/model/constraints/static.rb', line 19 def value @value end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
33 34 35 |
# File 'lib/dbee/model/constraints/static.rb', line 33 def ==(other) super && other.value == value end |
#hash ⇒ Object
29 30 31 |
# File 'lib/dbee/model/constraints/static.rb', line 29 def hash "#{super}#{value}".hash end |