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.
116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/rack/scriptstacker.rb', line 116 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
136 137 138 139 140 141 |
# File 'lib/rack/scriptstacker.rb', line 136 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
132 133 134 |
# File 'lib/rack/scriptstacker.rb', line 132 def serve_path normalize_end_slash normalize_begin_slash(@serve_path) end |
#source_path ⇒ Object
128 129 130 |
# File 'lib/rack/scriptstacker.rb', line 128 def source_path normalize_end_slash @source_path end |