Module: Accountable::CurrentMethods
- Defined in:
- lib/accountable/current_methods.rb
Instance Method Summary collapse
Instance Method Details
#current ⇒ Object
3 4 5 |
# File 'lib/accountable/current_methods.rb', line 3 def current Thread.current[self.class.name.tableize.singularize.to_sym] end |
#current=(something) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/accountable/current_methods.rb', line 7 def current=( something ) unless something.nil? || something.is_a?( self ) raise( ArgumentError, "Exception occurred while trying to set #{self.name}.current. Expected an object of type '#{self.name}', got an object of type ''#{something.class.name}'") end Thread.current[self.class.name.tableize.singularize.to_sym] = something end |