Module: MarkdownServer::PermittedBases
- Defined in:
- lib/markdown_server/permitted_bases.rb
Class Method Summary collapse
-
.base_for(real, bases) ⇒ Object
Returns the permitted base (one of ‘bases`) that contains `real`, or nil if no base contains it.
Class Method Details
.base_for(real, bases) ⇒ Object
Returns the permitted base (one of ‘bases`) that contains `real`, or nil if no base contains it. Each base is the realpath of the served root or a –follow-link target.
6 7 8 9 10 11 |
# File 'lib/markdown_server/permitted_bases.rb', line 6 def self.base_for(real, bases) Array(bases).each do |b| return b if real == b || real.start_with?("#{b}/") end nil end |