Module: Aqua::Pack::ClassMethods

ClassMethods

Public Visibility

Public Instance Method Summary

#_hidden_attributes

Reader method for accessing hidden attributes.

Returns: Array

#hide_attributes(*ivars)

Used in class declaration to assign certain instance variables as not for persistance.

Public Instance Method Details

_hidden_attributes

public Array _hidden_attributes

Reader method for accessing hidden attributes.

Meta Tags

Returns:

[Array]

containing strings representing instance variables

[View source]


42
43
44
# File 'lib/aqua/object/pack.rb', line 42

def _hidden_attributes 
  @_hidden_attributes ||= []
end

hide_attributes

public hide_attributes(*ivars)

Used in class declaration to assign certain instance variables as not for persistance

Meta Tags

Example:

class User 
  include Aqua::Object
  attr_accessor :username, :email, :password, :password_confirmation, :cryped_password, :salt
  hide_instance_variables :password, :password_confirmation 
  # ... lots more user code here ...
end
In this case it is useful for omitting sensitive information while persisting the object, but 
maintaining the password and confirmation temporarily requires the use of instance variables.
[View source]


32
33
34
35
36
37
# File 'lib/aqua/object/pack.rb', line 32

def hide_attributes( *ivars )
  ivars.each do |ivar|
    raise ArgumentError, '' unless ivar.class == Symbol
    _hidden_attributes << "@#{ivar}"
  end  
end
Generated on Monday, August 31 2009 at 03:23:20 PM by YARD 0.2.3.5 (ruby-1.8.6).