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.
41 42 43 |
# File 'lib/ooor.rb', line 41 def cache_store @cache_store end |
#default_config ⇒ Object
Returns the value of attribute default_config.
41 42 43 |
# File 'lib/ooor.rb', line 41 def default_config @default_config end |
#default_session ⇒ Object
Returns the value of attribute default_session.
41 42 43 |
# File 'lib/ooor.rb', line 41 def default_session @default_session end |
Instance Method Details
#cache(store = nil) ⇒ Object
64 65 66 |
# File 'lib/ooor.rb', line 64 def cache(store=nil) @cache_store ||= ActiveSupport::Cache.lookup_store(store) end |
#extensions ⇒ Object
75 76 77 |
# File 'lib/ooor.rb', line 75 def extensions @extensions ||= {} end |
#irregular_context_position(method) ⇒ Object
90 91 92 |
# File 'lib/ooor.rb', line 90 def irregular_context_position(method) IRREGULAR_CONTEXT_POSITIONS.merge(default_config[:irregular_context_positions] || {})[method.to_sym] end |
#logger ⇒ Object
82 83 84 |
# File 'lib/ooor.rb', line 82 def logger @logger ||= Logger.new($stdout) end |
#logger=(logger) ⇒ Object
86 87 88 |
# File 'lib/ooor.rb', line 86 def logger=(logger) @logger = logger end |
#model_registry ⇒ Object
80 |
# File 'lib/ooor.rb', line 80 def model_registry() @model_registry ||= ModelRegistry.new; end |
#new(config = {}) ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/ooor.rb', line 55 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
79 |
# File 'lib/ooor.rb', line 79 def session_handler() @session_handler ||= SessionHandler.new; end |
#xtend(model_name, &block) ⇒ Object
68 69 70 71 72 73 |
# File 'lib/ooor.rb', line 68 def xtend(model_name, &block) @extensions ||= {} @extensions[model_name] ||= [] @extensions[model_name] << block @extensions end |