Sha256: 8161ed4a0e9556e19157af6a70249183129a46b4cd183b5d73be56ab2dcb0d80

Contents?: true

Size: 626 Bytes

Versions: 6

Compression:

Stored size: 626 Bytes

Contents

module Nwiki
  module Core
    class Directory
      class << self
        attr_accessor :encoding
      end

      attr_reader :list

      def initialize path, list
        @path = path
        @list = list.
          reject { |e| e =~ /^__nwiki/ }.
          map { |e| e.sub(/\.org$/){ '' } }
      end

      def title
        @path
      end

      def encoding
        self.class.encoding
      end

      def to_html
        '<ul>' + @list.map { |e|
          root = './'
          root << @path if @path != '/'
          %Q!<li><a href="#{root}#{e}">#{e}</a></li>!
        }.join + '</ul>'
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nwiki-0.0.9 lib/nwiki/core/directory.rb
nwiki-0.0.8 lib/nwiki/core/directory.rb
nwiki-0.0.7 lib/nwiki/core/directory.rb
nwiki-0.0.6 lib/nwiki/core/directory.rb
nwiki-0.0.5 lib/nwiki/core/directory.rb
nwiki-0.0.4 lib/nwiki/core/directory.rb