Class: Toodledo::CommandLine::GoalFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/toodledo/command_line/goal_formatter.rb

Instance Method Summary collapse

Instance Method Details

#format(goal) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/toodledo/command_line/goal_formatter.rb', line 6

def format(goal)
  msg = "<#{goal.server_id}> -- #{readable_level(goal.level)} ^[#{goal.name}]"
  if (goal.contributes != Goal::NO_GOAL)
    msg += " (Contributes to: ^[#{goal.contributes.name}])"
  end
  return msg
end

#readable_level(level) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/toodledo/command_line/goal_formatter.rb', line 14

def readable_level(level)
  case level
  when Goal::LIFE_LEVEL
    return 'life'
  when Goal::MEDIUM_LEVEL
    return 'medium'
  when Goal::SHORT_LEVEL
    return 'short'
  end
end