Sha256: a8d66ee19d1cd5418a80b06687804d14c84d46dee7b6bb7c31455e1d74a973af

Contents?: true

Size: 733 Bytes

Versions: 24

Compression:

Stored size: 733 Bytes

Contents

module Jazzy
  class SourceMark
    attr_accessor :name
    attr_accessor :has_start_dash
    attr_accessor :has_end_dash

    def initialize(mark_string = nil)
      return unless mark_string

      # Format: 'MARK: - NAME -' with dashes optional
      mark_string.sub!(/^MARK: /, '')

      if mark_string.length == 0
        # Empty
        return
      elsif mark_string == '-'
        # Separator
        self.has_start_dash = true
        return
      end

      self.has_start_dash = mark_string.start_with?('- ')
      self.has_end_dash = mark_string.end_with?(' -')

      start_index = has_start_dash ? 2 : 0
      end_index = has_end_dash ? -3 : -1

      self.name = mark_string[start_index..end_index]
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
jazzy-0.5.0 lib/jazzy/source_mark.rb
jazzy-0.4.1 lib/jazzy/source_mark.rb
jazzy-0.4.0 lib/jazzy/source_mark.rb
jazzy-0.3.2 lib/jazzy/source_mark.rb
jazzy-0.3.1 lib/jazzy/source_mark.rb
jazzy-0.3.0 lib/jazzy/source_mark.rb
jazzy-0.2.4 lib/jazzy/source_mark.rb
jazzy-0.2.3 lib/jazzy/source_mark.rb
jazzy-0.2.2 lib/jazzy/source_mark.rb
jazzy-0.2.1 lib/jazzy/source_mark.rb
jazzy-0.2.0 lib/jazzy/source_mark.rb
jazzy-0.1.6 lib/jazzy/source_mark.rb
jazzy-0.1.5 lib/jazzy/source_mark.rb
jazzy-0.1.4 lib/jazzy/source_mark.rb
jazzy-0.1.3 lib/jazzy/source_mark.rb
jazzy-0.1.2 lib/jazzy/source_mark.rb
jazzy-0.1.1 lib/jazzy/source_mark.rb
jazzy-0.1.0 lib/jazzy/source_mark.rb
jazzy-0.0.20 lib/jazzy/source_mark.rb
jazzy-0.0.19 lib/jazzy/source_mark.rb