class Margin::Parser::Line

Attributes

annotations[R]
done[R]
offset[R]
raw_data[R]
type[R]
value[R]

Public Class Methods

new(raw_data) click to toggle source
# File lib/margin/parser.rb, line 109
def initialize(raw_data)
  @raw_data = raw_data
  @offset = detect_offset(raw_data)
  @annotations = { notes: [], indexes: {} }
  parse!
end

Private Instance Methods

parse!() click to toggle source
# File lib/margin/parser.rb, line 118
def parse!
  raw_inner = strip_line(raw_data)
  
  if detect_annotation_only(raw_inner)
    @type = :annotation
  elsif result = detect_task(raw_inner)
    @type = :task
    @done, raw_inner = result
  else
    @type = :item
  end

  @value, @annotations = extract_annotations(raw_inner)
end