Class: Dbee::Model::Constraints::Base
- Inherits:
-
Object
- Object
- Dbee::Model::Constraints::Base
- Defined in:
- lib/dbee/model/constraints/base.rb
Overview
Base class for all constraints.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(name:) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(name:) ⇒ Base
Returns a new instance of Base.
19 20 21 22 23 |
# File 'lib/dbee/model/constraints/base.rb', line 19 def initialize(name:) raise ArgumentError, 'name is required' if name.to_s.empty? @name = name.to_s end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
17 18 19 |
# File 'lib/dbee/model/constraints/base.rb', line 17 def name @name end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
29 30 31 |
# File 'lib/dbee/model/constraints/base.rb', line 29 def ==(other) other.name == name end |
#hash ⇒ Object
25 26 27 |
# File 'lib/dbee/model/constraints/base.rb', line 25 def hash name.hash end |