Sha256: c5d247fc0f263aeb5e75fe9bdb88e968c435f7c6eab4c179ca5d173174c498d6

Contents?: true

Size: 428 Bytes

Versions: 17

Compression:

Stored size: 428 Bytes

Contents

module LessonsIndexer
  module Models
    class Lesson < Base
      NAME_PATTERN = /(?<minor_major>(?<major>(\d+))(?:\.|-)(?<minor>(\d+)))(?<ext>\.md)/i
      attr_reader :name

      def initialize(file_name)
        super file_name
        @name = file_name.gsub(NAME_PATTERN, ' \k<minor_major>').titlecase
      end

      def link(dir)
        "* [#{name}](#{dir}/#{file_name})\n"
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
lessons_indexer-1.3.0 lib/lessons_indexer/models/lesson.rb
lessons_indexer-1.2.2 lib/lessons_indexer/models/lesson.rb
lessons_indexer-1.2.1 lib/lessons_indexer/models/lesson.rb
lessons_indexer-1.2.0 lib/lessons_indexer/models/lesson.rb
lessons_indexer-1.1.0 lib/lessons_indexer/models/lesson.rb
lessons_indexer-1.0.3 lib/lessons_indexer/models/lesson.rb
lessons_indexer-1.0.2.1 lib/lessons_indexer/models/lesson.rb
lessons_indexer-1.0.0 lib/lessons_indexer/models/lesson.rb
lessons_indexer-0.3.1 lib/lessons_indexer/models/lesson.rb
lessons_indexer-0.3.0 lib/lessons_indexer/models/lesson.rb
lessons_indexer-0.2.3 lib/lessons_indexer/models/lesson.rb
lessons_indexer-0.2.2 lib/lessons_indexer/models/lesson.rb
lessons_indexer-0.2.1 lib/lessons_indexer/models/lesson.rb
lessons_indexer-0.2.0 lib/lessons_indexer/models/lesson.rb
lessons_indexer-0.1.2 lib/lessons_indexer/models/lesson.rb
lessons_indexer-0.1.1 lib/lessons_indexer/models/lesson.rb
lessons_indexer-0.1.0 lib/lessons_indexer/models/lesson.rb