Class: Glue::Validation::Key
Overview
A Key is used to uniquely identify a validation rule.
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#validation ⇒ Object
readonly
Returns the value of attribute validation.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #hash ⇒ Object
-
#initialize(validation, field) ⇒ Key
constructor
A new instance of Key.
Constructor Details
#initialize(validation, field) ⇒ Key
Returns a new instance of Key.
134 135 136 |
# File 'lib/more/facets/validation.rb', line 134 def initialize(validation, field) @validation, @field = validation.to_s, field.to_s end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
132 133 134 |
# File 'lib/more/facets/validation.rb', line 132 def field @field end |
#validation ⇒ Object (readonly)
Returns the value of attribute validation.
131 132 133 |
# File 'lib/more/facets/validation.rb', line 131 def validation @validation end |
Instance Method Details
#==(other) ⇒ Object
142 143 144 |
# File 'lib/more/facets/validation.rb', line 142 def ==(other) self.validation == other.validation and self.field == other.field end |
#hash ⇒ Object
138 139 140 |
# File 'lib/more/facets/validation.rb', line 138 def hash "#{@validation}-#{@field}".hash end |