Class: BridgetownDirectus::Configuration
- Inherits:
-
Object
- Object
- BridgetownDirectus::Configuration
- Defined in:
- lib/bridgetown_directus/configuration.rb,
lib/bridgetown_directus.rb
Overview
Configuration module for Bridgetown Directus plugin
Defined Under Namespace
Classes: CollectionConfig
Instance Attribute Summary collapse
-
#api_url ⇒ Object
Returns the value of attribute api_url.
-
#collections ⇒ Object
readonly
Returns the value of attribute collections.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
-
#find_collection(name) ⇒ CollectionConfig?
Find a collection by name.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#register_collection(name, &block) ⇒ CollectionConfig
Register a new collection with the given name.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
28 29 30 |
# File 'lib/bridgetown_directus.rb', line 28 def initialize @collections = {} end |
Instance Attribute Details
#api_url ⇒ Object
Returns the value of attribute api_url.
25 26 27 |
# File 'lib/bridgetown_directus.rb', line 25 def api_url @api_url end |
#collections ⇒ Object (readonly)
Returns the value of attribute collections.
26 27 28 |
# File 'lib/bridgetown_directus.rb', line 26 def collections @collections end |
#token ⇒ Object
Returns the value of attribute token.
25 26 27 |
# File 'lib/bridgetown_directus.rb', line 25 def token @token end |
Instance Method Details
#find_collection(name) ⇒ CollectionConfig?
Find a collection by name
27 28 29 |
# File 'lib/bridgetown_directus/configuration.rb', line 27 def find_collection(name) @collections[name] end |
#register_collection(name, &block) ⇒ CollectionConfig
Register a new collection with the given name
17 18 19 20 21 22 |
# File 'lib/bridgetown_directus/configuration.rb', line 17 def register_collection(name, &block) collection = CollectionConfig.new(name) collection.instance_eval(&block) if block_given? @collections[name] = collection collection end |