Class: Nemo::MetaObject::PasswordAttribute

Inherits:
TextAttribute show all
Defined in:
lib/nemo/metaobject/attributes.rb

Instance Attribute Summary collapse

Attributes inherited from Attribute

#cache, #metaobject, #symbol, #validation_rules

Instance Method Summary collapse

Methods inherited from TextAttribute

#add_required_rule, #cache, #initialize

Methods inherited from Attribute

#add_required_rule, #add_validation_rule, #commit_cache, #error_class, #format, #formatted_value, #initialize, #required, #required?, #rule_class, #value

Methods included from Util::Accessors

#bool_accessor, #call_accessor, #proc_accessor

Constructor Details

This class inherits a constructor from Nemo::MetaObject::TextAttribute

Instance Attribute Details

#cache_confirmObject

Returns the value of attribute cache_confirm.



103
104
105
# File 'lib/nemo/metaobject/attributes.rb', line 103

def cache_confirm
  @cache_confirm
end

Instance Method Details

#accept(visitor) ⇒ Object



105
106
107
# File 'lib/nemo/metaobject/attributes.rb', line 105

def accept(visitor)
  visitor.visit_password_attribute(self)
end

#refresh_cacheObject



109
110
111
112
# File 'lib/nemo/metaobject/attributes.rb', line 109

def refresh_cache
  super
  @cache_confirm = @cache
end

#validate_cacheObject



114
115
116
117
# File 'lib/nemo/metaobject/attributes.rb', line 114

def validate_cache
  return error_class.new(self, 'Confirmation of password is not correct.') if @cache != @cache_confirm
  super
end