Class: MDView::Sinatra

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/mdview/sinatra.rb

Instance Method Summary collapse

Instance Method Details



23
24
25
# File 'lib/mdview/sinatra.rb', line 23

def link_to(f)
  File.directory?(f) ? "/dir=#{f}" : "/file=#{f}"
end

#subpath_of_pwd?(f) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
30
31
# File 'lib/mdview/sinatra.rb', line 27

def subpath_of_pwd?(f)
  c = Pathname.pwd.realpath.to_s
  x = Pathname.new(f).realpath.to_s
  "#{x}/".start_with? "#{c}/"
end