Module: PageReader
Instance Method Summary collapse
- #escape(s) ⇒ Object
-
#read(raw_filename) ⇒ Object
read the source file.
-
#view(s) ⇒ Object
view the published file.
Instance Method Details
#escape(s) ⇒ Object
39 40 41 |
# File 'lib/mymedia-pages.rb', line 39 def escape(s) s.gsub(/ +/,'_')#.gsub(/'/,'%27') end |
#read(raw_filename) ⇒ Object
read the source file
17 18 19 20 21 22 |
# File 'lib/mymedia-pages.rb', line 17 def read(raw_filename) filename = escape(raw_filename) FileX.read File.join(@media_src, filename) end |
#view(s) ⇒ Object
view the published file
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/mymedia-pages.rb', line 26 def view(s) filepath = if s.count('/') > 1 then # archived file File.join(@home, @www, @public_type, s.sub(/\.html$/,'') + '.html') else # static file File.join(@home, @www, @public_type, s.sub(/\.html$/,'') + '.html') end FileX.read(filepath) end |