Sha256: b74d0df1628b2d30c9c2b451c1f733f1338a923ec2ddba29ea85e883911635cf

Contents?: true

Size: 541 Bytes

Versions: 2

Compression:

Stored size: 541 Bytes

Contents

class JsTestServer::Server::Representations::Dir < JsTestServer::Server::Representations::Page
  needs :relative_path, :absolute_path
  attr_reader :relative_path, :absolute_path
  protected

  def body_content
    ul do
      ::Dir.glob("#{absolute_path}/*").inject("") do |html, file|
        li do
          a(
            ::File.basename(file),
            :href => "#{relative_path}/#{::File.basename(file)}".gsub("//", "/")
          )
        end
      end
    end
  end

  def title_text
    "Contents of #{relative_path}"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
js-test-server-0.2.1 lib/js_test_server/server/representations/dir.html.rb
js-test-server-0.2.0 lib/js_test_server/server/representations/dir.html.rb