I couldn't really find this in Rails documentation but it seems like 'mattr_accessor' is the Module corollary for 'attr_accessor' (getter & setter) in a normal Ruby class.
Eg. in a class
class User
attr_accessor :name
def set_fullname
@name = "#{self.first_name} #{self.last_name}"
end
end
Eg. in a module
module Authentication
mattr_accessor :current_user
def login
@current_user = session[:user_id] || nil
end
end
This helper method is provided by ActiveSupport.