Class: Rack::Directory::DirectoryBody
- Inherits:
-
Struct
- Object
- Struct
- Rack::Directory::DirectoryBody
- Defined in:
- lib/rack/directory.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
Returns the value of attribute files.
-
#path ⇒ Object
Returns the value of attribute path.
-
#root ⇒ Object
Returns the value of attribute root.
Instance Method Summary collapse
Instance Attribute Details
#files ⇒ Object
Returns the value of attribute files
42 43 44 |
# File 'lib/rack/directory.rb', line 42 def files @files end |
#path ⇒ Object
Returns the value of attribute path
42 43 44 |
# File 'lib/rack/directory.rb', line 42 def path @path end |
#root ⇒ Object
Returns the value of attribute root
42 43 44 |
# File 'lib/rack/directory.rb', line 42 def root @root end |
Instance Method Details
#each ⇒ Object
43 44 45 46 47 48 |
# File 'lib/rack/directory.rb', line 43 def each show_path = Rack::Utils.escape_html(path.sub(/^#{root}/,'')) listings = files.map{|f| DIR_FILE % DIR_FILE_escape(*f) }*"\n" page = DIR_PAGE % [ show_path, show_path , listings ] page.each_line{|l| yield l } end |