Module: DcInternals
- Defined in:
- app/models/dc_internals.rb
Overview
Internals model represents bridge to action’s internal variables like session, params, record … They are used for interacting with user in terms they understand and provides internal values behind the scene.
Constant Summary collapse
- INTERNALS =
{ 'current_user' => 'session[:user_id]', 'current_user_name' => 'session[:user_name]', 'current_site' => 'dc_get_site.id' }
Class Method Summary collapse
-
.add_internal(hash) ⇒ Object
Add additional internal.
-
.get(key) ⇒ Object
Add additional internal.
Class Method Details
.add_internal(hash) ⇒ Object
Add additional internal. This method allows application specific internals to be added to structure and be used together with predefined values.
42 43 44 |
# File 'app/models/dc_internals.rb', line 42 def self.add_internal(hash) hash.each {|key,value| additions[key] = value} end |
.get(key) ⇒ Object
Add additional internal. This method allows application specific internals to be added to structure and be used together with predefined values.
50 51 52 53 54 55 56 |
# File 'app/models/dc_internals.rb', line 50 def self.get(key) key = key.sub('@','') value = INTERNALS[key] value = @additions[key] if value.nil? value end |