Class: FormKeeper::Record
- Inherits:
-
Object
- Object
- FormKeeper::Record
- Defined in:
- lib/formkeeper.rb
Instance Attribute Summary collapse
-
#failed_constraints ⇒ Object
readonly
Returns the value of attribute failed_constraints.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #fail(constraint) ⇒ Object
- #failed? ⇒ Boolean
- #failed_by?(constraint) ⇒ Boolean
-
#initialize(name) ⇒ Record
constructor
A new instance of Record.
Constructor Details
#initialize(name) ⇒ Record
Returns a new instance of Record.
418 419 420 421 422 |
# File 'lib/formkeeper.rb', line 418 def initialize(name) @name = name @value = nil @failed_constraints = [] end |
Instance Attribute Details
#failed_constraints ⇒ Object (readonly)
Returns the value of attribute failed_constraints.
416 417 418 |
# File 'lib/formkeeper.rb', line 416 def failed_constraints @failed_constraints end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
416 417 418 |
# File 'lib/formkeeper.rb', line 416 def name @name end |
#value ⇒ Object
Returns the value of attribute value.
417 418 419 |
# File 'lib/formkeeper.rb', line 417 def value @value end |
Instance Method Details
#fail(constraint) ⇒ Object
423 424 425 |
# File 'lib/formkeeper.rb', line 423 def fail(constraint) @failed_constraints << constraint end |
#failed? ⇒ Boolean
426 427 428 |
# File 'lib/formkeeper.rb', line 426 def failed? @failed_constraints.size > 0 end |
#failed_by?(constraint) ⇒ Boolean
429 430 431 |
# File 'lib/formkeeper.rb', line 429 def failed_by?(constraint) @failed_constraints.include?(constraint.to_sym) end |