Class: Rack::ScriptStackerUtils::PathSpec

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/scriptstacker.rb

Instance Method Summary collapse

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

Returns:

  • (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_pathObject



132
133
134
# File 'lib/rack/scriptstacker.rb', line 132

def serve_path
  normalize_end_slash normalize_begin_slash(@serve_path)
end

#source_pathObject



128
129
130
# File 'lib/rack/scriptstacker.rb', line 128

def source_path
  normalize_end_slash @source_path
end