Module: Pomodoro::Formats::Scheduled

Defined in:
lib/pomodoro/formats/scheduled.rb,
lib/pomodoro/formats/scheduled/task_list.rb,
lib/pomodoro/formats/scheduled/task_group.rb,
lib/pomodoro/formats/scheduled/parser/parser.rb,
lib/pomodoro/formats/scheduled/parser/transformer.rb

Overview

Defined Under Namespace

Classes: Parser, TaskGroup, TaskList, Transformer

Class Method Summary collapse

Class Method Details

.parse(string) ⇒ TaskList?

The entry point method for parsing this format.

Examples:

require 'pomodoro/formats/scheduled'

task_list = Pomodoro::Formats::Scheduled.parse <<-EOF.gsub(/^\s*/, '')
  Tomorrow
  - Buy milk. #errands
  - [9:20] Call with Mike.

  Prague
  - Pick up my shoes. #errands
EOF

Parameters:

  • string (String)

    string in the scheduled task list format

Returns:

Since:

  • 1.0



25
26
27
28
29
# File 'lib/pomodoro/formats/scheduled.rb', line 25

def self.parse(string)
  tree = Parser.new.parse_with_debug(string)
  nodes = Transformer.new.apply(tree)
  TaskList.new(nodes) unless nodes.empty?
end