Class: MySQLExpectations::KeyField
- Inherits:
-
Object
- Object
- MySQLExpectations::KeyField
- Defined in:
- lib/mysql_expectations/key_field.rb
Overview
An index field has a field name, length, and order (aka order)
Constant Summary collapse
- ORDER_ASC =
:asc
- ORDER_DESC =
:desc
- VALID_ORDERINGS =
[ORDER_ASC, ORDER_DESC]
Instance Attribute Summary collapse
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name, order = nil, length = nil) ⇒ KeyField
constructor
A new instance of KeyField.
- #to_s ⇒ Object
Constructor Details
#initialize(name, order = nil, length = nil) ⇒ KeyField
Returns a new instance of KeyField.
16 17 18 19 20 |
# File 'lib/mysql_expectations/key_field.rb', line 16 def initialize(name, order = nil, length = nil) @name = name @order = validate_order(order) @length = validate_length(length) end |
Instance Attribute Details
#length ⇒ Object (readonly)
Returns the value of attribute length.
9 10 11 |
# File 'lib/mysql_expectations/key_field.rb', line 9 def length @length end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/mysql_expectations/key_field.rb', line 9 def name @name end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
9 10 11 |
# File 'lib/mysql_expectations/key_field.rb', line 9 def order @order end |
Instance Method Details
#==(other) ⇒ Object
22 23 24 |
# File 'lib/mysql_expectations/key_field.rb', line 22 def ==(other) other.name == @name && other.length == @length && other.order == @order end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/mysql_expectations/key_field.rb', line 26 def to_s "{ '#{name}', #{order_to_s}, #{length_to_s} }" end |