Class: Pieces::Config
- Inherits:
-
Hash
- Object
- Hash
- Pieces::Config
- Defined in:
- lib/pieces/config.rb
Instance Attribute Summary collapse
-
#env ⇒ Object
Returns the value of attribute env.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #asset_prefix ⇒ Object
- #force_polling? ⇒ Boolean
- #globals ⇒ Object
-
#initialize(config = {}) ⇒ Config
constructor
A new instance of Config.
- #publish_endpoint ⇒ Object
- #reload! ⇒ Object
- #routes ⇒ Object
Constructor Details
#initialize(config = {}) ⇒ Config
Returns a new instance of Config.
9 10 11 12 |
# File 'lib/pieces/config.rb', line 9 def initialize(config = {}) @path = config[:path] || Dir.pwd load_config! unless config[:load] == false end |
Instance Attribute Details
#env ⇒ Object
Returns the value of attribute env.
7 8 9 |
# File 'lib/pieces/config.rb', line 7 def env @env end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/pieces/config.rb', line 6 def path @path end |
Instance Method Details
#asset_prefix ⇒ Object
34 35 36 |
# File 'lib/pieces/config.rb', line 34 def asset_prefix self['_asset_prefix'] end |
#force_polling? ⇒ Boolean
30 31 32 |
# File 'lib/pieces/config.rb', line 30 def force_polling? self['_force_polling'] end |
#globals ⇒ Object
18 19 20 |
# File 'lib/pieces/config.rb', line 18 def globals self['_global'] || {} end |
#publish_endpoint ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/pieces/config.rb', line 22 def publish_endpoint if has_key?('_publish') self['_publish'].first else raise PublisherConfigNotFound end end |
#reload! ⇒ Object
38 39 40 |
# File 'lib/pieces/config.rb', line 38 def reload! load_config! end |
#routes ⇒ Object
14 15 16 |
# File 'lib/pieces/config.rb', line 14 def routes reject { |key, _| key =~ /^_/ } end |