Sha256: d57730be044122c7f7dca7fada7458a15469957133c9a3e065e6b3dc30a389bc

Contents?: true

Size: 728 Bytes

Versions: 17

Compression:

Stored size: 728 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.empty?
        # 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

17 entries across 17 versions & 1 rubygems

Version Path
jazzy-0.9.1 lib/jazzy/source_mark.rb
jazzy-0.9.0 lib/jazzy/source_mark.rb
jazzy-0.8.4 lib/jazzy/source_mark.rb
jazzy-0.8.3 lib/jazzy/source_mark.rb
jazzy-0.8.2 lib/jazzy/source_mark.rb
jazzy-0.8.1 lib/jazzy/source_mark.rb
jazzy-0.8.0 lib/jazzy/source_mark.rb
jazzy-0.7.5 lib/jazzy/source_mark.rb
jazzy-0.7.4 lib/jazzy/source_mark.rb
jazzy-0.7.3 lib/jazzy/source_mark.rb
jazzy-0.7.2 lib/jazzy/source_mark.rb
jazzy-0.7.1 lib/jazzy/source_mark.rb
jazzy-0.7.0 lib/jazzy/source_mark.rb
jazzy-0.6.3 lib/jazzy/source_mark.rb
jazzy-0.6.2 lib/jazzy/source_mark.rb
jazzy-0.6.1 lib/jazzy/source_mark.rb
jazzy-0.6.0 lib/jazzy/source_mark.rb