Class: Sinatra::Minify::Config
- Inherits:
-
Object
- Object
- Sinatra::Minify::Config
- Defined in:
- lib/sinatra/minify/config.rb
Instance Method Summary collapse
- #config_file ⇒ Object
- #css_url ⇒ Object
-
#initialize(type, app_class = ::Main) ⇒ Config
constructor
A new instance of Config.
- #js_url ⇒ Object
- #public_dir(*args) ⇒ Object
- #public_url(path) ⇒ Object
- #root_path(*args) ⇒ Object
- #sets ⇒ Object
Constructor Details
#initialize(type, app_class = ::Main) ⇒ Config
Returns a new instance of Config.
4 5 6 7 |
# File 'lib/sinatra/minify/config.rb', line 4 def initialize(type, app_class = ::Main) @settings = app_class @type = type.to_s end |
Instance Method Details
#config_file ⇒ Object
29 30 31 |
# File 'lib/sinatra/minify/config.rb', line 29 def config_file @settings.minify_config end |
#css_url ⇒ Object
13 14 15 |
# File 'lib/sinatra/minify/config.rb', line 13 def css_url @settings.css_url end |
#js_url ⇒ Object
9 10 11 |
# File 'lib/sinatra/minify/config.rb', line 9 def js_url @settings.js_url end |
#public_dir(*args) ⇒ Object
17 18 19 |
# File 'lib/sinatra/minify/config.rb', line 17 def public_dir(*args) root_path(@settings.send("#{@type}_path"), *args) end |
#public_url(path) ⇒ Object
21 22 23 |
# File 'lib/sinatra/minify/config.rb', line 21 def public_url(path) File.join(@settings.send("#{@type}_url"), path).squeeze('/') end |
#root_path(*args) ⇒ Object
25 26 27 |
# File 'lib/sinatra/minify/config.rb', line 25 def root_path(*args) File.join(File.dirname(@settings.app_file), *args) end |
#sets ⇒ Object
33 34 35 |
# File 'lib/sinatra/minify/config.rb', line 33 def sets YAML.load_file(root_path(config_file))[@type] end |