Module: Ooor::OoorBehavior::ClassMethods
- Defined in:
- lib/ooor.rb
Constant Summary collapse
- IRREGULAR_CONTEXT_POSITIONS =
{ import_data: 5, fields_view_get: 2, search: 4, name_search: 3, read_group: 5, fields_get: 1, read: 2, perm_read: 1, check_recursion: 1 }
Instance Attribute Summary collapse
-
#cache_store ⇒ Object
Returns the value of attribute cache_store.
-
#default_config ⇒ Object
Returns the value of attribute default_config.
-
#default_session ⇒ Object
Returns the value of attribute default_session.
Instance Method Summary collapse
- #cache(store = nil) ⇒ Object
- #extensions ⇒ Object
- #irregular_context_position(method) ⇒ Object
- #logger ⇒ Object
- #logger=(logger) ⇒ Object
- #model_registry ⇒ Object
- #new(config = {}) ⇒ Object
- #session_handler ⇒ Object
- #xtend(model_name, &block) ⇒ Object
Instance Attribute Details
#cache_store ⇒ Object
Returns the value of attribute cache_store.
43 44 45 |
# File 'lib/ooor.rb', line 43 def cache_store @cache_store end |
#default_config ⇒ Object
Returns the value of attribute default_config.
43 44 45 |
# File 'lib/ooor.rb', line 43 def default_config @default_config end |
#default_session ⇒ Object
Returns the value of attribute default_session.
43 44 45 |
# File 'lib/ooor.rb', line 43 def default_session @default_session end |
Instance Method Details
#cache(store = nil) ⇒ Object
66 67 68 |
# File 'lib/ooor.rb', line 66 def cache(store=nil) @cache_store ||= ActiveSupport::Cache.lookup_store(store) end |
#extensions ⇒ Object
77 78 79 |
# File 'lib/ooor.rb', line 77 def extensions @extensions ||= {} end |
#irregular_context_position(method) ⇒ Object
92 93 94 |
# File 'lib/ooor.rb', line 92 def irregular_context_position(method) IRREGULAR_CONTEXT_POSITIONS.merge(default_config[:irregular_context_positions] || {})[method.to_sym] end |
#logger ⇒ Object
84 85 86 |
# File 'lib/ooor.rb', line 84 def logger @logger ||= Logger.new($stdout) end |
#logger=(logger) ⇒ Object
88 89 90 |
# File 'lib/ooor.rb', line 88 def logger=(logger) @logger = logger end |
#model_registry ⇒ Object
82 |
# File 'lib/ooor.rb', line 82 def model_registry() @model_registry ||= ModelRegistry.new; end |
#new(config = {}) ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'lib/ooor.rb', line 57 def new(config={}) Ooor.default_config = config.merge(generate_constants: true) session = session_handler.retrieve_session(config) if config[:database] && config[:password] session.global_login(config) end Ooor.default_session = session end |
#session_handler ⇒ Object
81 |
# File 'lib/ooor.rb', line 81 def session_handler() @session_handler ||= SessionHandler.new; end |
#xtend(model_name, &block) ⇒ Object
70 71 72 73 74 75 |
# File 'lib/ooor.rb', line 70 def xtend(model_name, &block) @extensions ||= {} @extensions[model_name] ||= [] @extensions[model_name] << block @extensions end |