Class: Flagdoc::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/flagdoc/parser.rb

Overview

Since:

  • 0.1.0

Constant Summary collapse

SPLIT_ORDER =

Since:

  • 0.1.0

{
  'path' => 0,
  'line' => 1
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(string:) ⇒ Parser

Returns a new instance of Parser.

Since:

  • 0.1.0



10
11
12
# File 'lib/flagdoc/parser.rb', line 10

def initialize(string:)
  @string = string
end

Instance Method Details

#descriptionObject

Since:

  • 0.1.0



40
41
42
# File 'lib/flagdoc/parser.rb', line 40

def description
  splitted[2].split(']').last.strip
end

#priorityObject

Since:

  • 0.1.0



32
33
34
35
36
37
# File 'lib/flagdoc/parser.rb', line 32

def priority
  return 'NORMAL' unless type_and_priority.count > 1
  priority = type_and_priority.last.strip

  Priority.available?(priority) ? priority : 'NORMAL'
end

#typeObject

Since:

  • 0.1.0



22
23
24
# File 'lib/flagdoc/parser.rb', line 22

SPLIT_ORDER.each do |type, order|
  define_method(type.to_s) { splitted[order] }
end