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].to_s', 'current_user_name' => 'session[:user_name]', 'current_site' => 'dc_get_site.id.to_s' }
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.
41 42 43 |
# File 'app/models/dc_internals.rb', line 41 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.
49 50 51 52 |
# File 'app/models/dc_internals.rb', line 49 def self.get(key) key.sub!('@', '') INTERNALS[key] || @additions[key] end |