class Flagdoc::Parser

@since 0.1.0

Constants

DEFAULT_LEVEL
SPLIT_ORDER

Public Class Methods

new(string:) click to toggle source
# File lib/flagdoc/parser.rb, line 11
def initialize(string:)
  @string = string
end

Public Instance Methods

description() click to toggle source

@since 0.1.0

# File lib/flagdoc/parser.rb, line 41
def description
  splitted[2].split(']').last.strip
end
priority() click to toggle source

@since 0.1.0

# File lib/flagdoc/parser.rb, line 33
def priority
  return DEFAULT_LEVEL unless type_and_priority.count > 1
  priority = type_and_priority.last.strip

  Priority.available?(priority) ? priority : DEFAULT_LEVEL
end
type() click to toggle source

@since 0.1.0

# File lib/flagdoc/parser.rb, line 28
def type
  type_and_priority.first.strip
end

Private Instance Methods

splitted() click to toggle source
# File lib/flagdoc/parser.rb, line 47
def splitted
  @splitted ||= @string.split(':')
end
type_and_priority() click to toggle source
# File lib/flagdoc/parser.rb, line 51
def type_and_priority
  @type_and_priority ||=
    splitted[2][/\[(.*)\]/m, 1].strip.split(',')
end