Class: Rack::ScriptStackerUtils::PathSpec
- Inherits:
-
Object
- Object
- Rack::ScriptStackerUtils::PathSpec
- Defined in:
- lib/rack/scriptstacker.rb
Instance Method Summary collapse
-
#initialize(paths) ⇒ PathSpec
constructor
A new instance of PathSpec.
- #paths_identical? ⇒ Boolean
- #serve_path ⇒ Object
- #source_path ⇒ Object
Constructor Details
#initialize(paths) ⇒ PathSpec
Returns a new instance of PathSpec.
101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/rack/scriptstacker.rb', line 101 def initialize paths if paths.respond_to? :key # this is just for pretty method calls, eg. # css 'stylesheets' => 'static/css' @source_path, @serve_path = paths.to_a.flatten else # if only one path is given, use the same for both; # this is just like how Rack::Static works @source_path = @serve_path = paths end end |
Instance Method Details
#paths_identical? ⇒ Boolean
121 122 123 124 125 126 |
# File 'lib/rack/scriptstacker.rb', line 121 def paths_identical? # Paths are normalized differently, so this check isn't doable from # outside the instance; but we still want to know if they're basically # the same so we can easily configure Rack::Static to match. @source_path == @serve_path end |
#serve_path ⇒ Object
117 118 119 |
# File 'lib/rack/scriptstacker.rb', line 117 def serve_path normalize_end_slash normalize_begin_slash(@serve_path) end |
#source_path ⇒ Object
113 114 115 |
# File 'lib/rack/scriptstacker.rb', line 113 def source_path normalize_end_slash @source_path end |