class Trole::Storage::RefOne
Public Class Methods
new(role_subject)
click to toggle source
constructor @param [Symbol] the role subject
Calls superclass method
Trole::Storage::BaseOne::new
# File lib/trole/storage/ref_one.rb, line 11 def initialize role_subject super end
Public Instance Methods
clear!()
click to toggle source
Clears the role state of the role subject
# File lib/trole/storage/ref_one.rb, line 35 def clear! set_ds_field nil end
display_roles()
click to toggle source
display the role as a list of one symbol @return [Array<Symbol>] roles list
# File lib/trole/storage/ref_one.rb, line 17 def display_roles return [] if !ds_field_value? [ds_field_value.name.to_sym] end
ds_field_value?()
click to toggle source
is it set?
# File lib/trole/storage/ref_one.rb, line 23 def ds_field_value? ds_field_value end
set_role(role)
click to toggle source
saves the role of the role subject in the data store @param [Symbol] the role name
# File lib/trole/storage/ref_one.rb, line 29 def set_role role role_to_set = role_model.where(:name => role).first set_ds_field role_to_set end