Class: Sphere::Config
- Inherits:
-
Object
- Object
- Sphere::Config
- Defined in:
- lib/sphere/config.rb
Instance Attribute Summary collapse
- #asset_path ⇒ Object
- #backend ⇒ Object
-
#compress ⇒ Object
writeonly
Sets the attribute compress.
- #config_file ⇒ Object
-
#env ⇒ Object
Returns the value of attribute env.
-
#package ⇒ Object
writeonly
Sets the attribute package.
-
#root ⇒ Object
Returns the value of attribute root.
Instance Method Summary collapse
- #asset_root ⇒ Object
- #compass? ⇒ Boolean
- #compress? ⇒ Boolean
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #javascripts ⇒ Object
- #package? ⇒ Boolean
- #public_path ⇒ Object
- #stylesheets ⇒ Object
- #update!(&block) ⇒ Object
Constructor Details
Instance Attribute Details
#asset_path ⇒ Object
20 21 22 |
# File 'lib/sphere/config.rb', line 20 def asset_path @asset_path || definitions['asset_path'] || 'assets' end |
#backend ⇒ Object
28 29 30 |
# File 'lib/sphere/config.rb', line 28 def backend @backend || "Sphere::Backends::#{(definitions['backend'] || 'closure').classify}".constantize end |
#compress=(value) ⇒ Object (writeonly)
Sets the attribute compress
4 5 6 |
# File 'lib/sphere/config.rb', line 4 def compress=(value) @compress = value end |
#config_file ⇒ Object
16 17 18 |
# File 'lib/sphere/config.rb', line 16 def config_file @config_file || root.join('config', 'sphere.yml') end |
#env ⇒ Object
Returns the value of attribute env.
3 4 5 |
# File 'lib/sphere/config.rb', line 3 def env @env end |
#package=(value) ⇒ Object (writeonly)
Sets the attribute package
4 5 6 |
# File 'lib/sphere/config.rb', line 4 def package=(value) @package = value end |
#root ⇒ Object
Returns the value of attribute root.
3 4 5 |
# File 'lib/sphere/config.rb', line 3 def root @root end |
Instance Method Details
#asset_root ⇒ Object
24 25 26 |
# File 'lib/sphere/config.rb', line 24 def asset_root public_path.join(asset_path) end |
#compass? ⇒ Boolean
44 45 46 |
# File 'lib/sphere/config.rb', line 44 def compass? definitions.key?('compass') ? !!definitions['compass'] : false end |
#compress? ⇒ Boolean
40 41 42 |
# File 'lib/sphere/config.rb', line 40 def compress? defined?(@compress) ? !!@compress : (definitions.key?('compress') ? !!definitions['compress'] : (self.env == 'production')) end |
#javascripts ⇒ Object
32 33 34 |
# File 'lib/sphere/config.rb', line 32 def javascripts definitions['javascripts'] ||= {} end |
#package? ⇒ Boolean
48 49 50 |
# File 'lib/sphere/config.rb', line 48 def package? defined?(@package) ? !!@package : (definitions.key?('package') ? !!definitions['package'] : (self.env == 'production')) end |
#public_path ⇒ Object
52 53 54 |
# File 'lib/sphere/config.rb', line 52 def public_path @public_path ||= defined?(Rails) ? Pathname.new(Rails.public_path.to_s) : root.join('public') end |
#stylesheets ⇒ Object
36 37 38 |
# File 'lib/sphere/config.rb', line 36 def stylesheets definitions['stylesheets'] ||= {} end |
#update!(&block) ⇒ Object
11 12 13 14 |
# File 'lib/sphere/config.rb', line 11 def update!(&block) block.call(self) self end |