Module: Annex
- Defined in:
- lib/annex/version.rb,
lib/annex-cms.rb,
lib/annex/config.rb,
lib/annex/engine.rb,
lib/annex/railtie.rb,
lib/annex/extension.rb,
app/models/annex/block.rb,
lib/annex/view_helpers.rb,
app/controllers/annex/blocks_controller.rb,
app/controllers/annex/application_controller.rb,
lib/annex/extensions/cancan/authorization_adapter.rb
Overview
Block Model
Stores the raw information in the database
Defined Under Namespace
Modules: Config, Extensions, ViewHelpers Classes: ApplicationController, BlocksController, Engine, Railtie
Constant Summary collapse
- VERSION =
'0.5.0'- EXTENSIONS =
[]
- AUTHORIZATION_ADAPTERS =
{}
Class Method Summary collapse
-
.add_extension(extension_key, extension_definition, options = {}) ⇒ Object
Extend Annex.
- .config ⇒ Object
-
.configure(opts = {}) ⇒ Object
Configure through hash.
-
.configure_with(path_to_yaml_file) ⇒ Object
Configure through yaml file.
Class Method Details
.add_extension(extension_key, extension_definition, options = {}) ⇒ Object
Extend Annex
The extension may define various adapters (e.g., for authorization) and register those via the options hash.
9 10 11 12 13 14 15 16 17 |
# File 'lib/annex/extension.rb', line 9 def self.add_extension(extension_key, extension_definition, = {}) .assert_valid_keys(:authorization, :configuration, :auditing) EXTENSIONS << extension_key if( = [:authorization]) AUTHORIZATION_ADAPTERS[extension_key] = extension_definition::AuthorizationAdapter end end |
.config ⇒ Object
33 34 35 |
# File 'lib/annex-cms.rb', line 33 def self.config @config end |
.configure(opts = {}) ⇒ Object
Configure through hash
16 17 18 |
# File 'lib/annex-cms.rb', line 16 def self.configure(opts = {}) opts.each { |k,v| @config[k.to_sym] = v if @valid_config_keys.include? k.to_sym } end |
.configure_with(path_to_yaml_file) ⇒ Object
Configure through yaml file
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/annex-cms.rb', line 21 def self.configure_with(path_to_yaml_file) begin config = YAML::load(IO.read(path_to_yaml_file)) rescue Errno::ENOENT log(:warning, "YAML configuration file couldn't be found. Using defaults."); return rescue Psych::SyntaxError log(:warning, "YAML configuration file contains invalid syntax. Using defaults."); return end configure(config) end |