todo-void 0.1.1 → 0.1.2.alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/todo_store.rb CHANGED
@@ -32,7 +32,7 @@ class TodoStore
32
32
  end
33
33
  @list = TodoList.new(todos)
34
34
  end
35
-
35
+
36
36
  def convert_raw_todo(raw_todo)
37
37
  todo = Todo.new raw_todo[0]
38
38
  unless raw_todo[2].nil?
data/lib/todo_view.rb CHANGED
@@ -6,15 +6,34 @@ class TodoView
6
6
  end
7
7
 
8
8
  def render
9
- output = if @todo.status == :finished
10
- "#{@todo.id} #{@todo.description}".foreground(:black)
11
- elsif @todo.status == :started
12
- "#{@todo.id.foreground(:green)} #{@todo.description}"
9
+ output = "#{formated_id} #{@todo.description}"
10
+ output += tags
11
+ mark_if_finished(output)
12
+ end
13
+
14
+ private
15
+ def formated_id
16
+ if @todo.status == :started
17
+ @todo.id.foreground(:green)
18
+ elsif @todo.status == :pending
19
+ @todo.id.foreground(:yellow)
13
20
  else
14
- "#{@todo.id.foreground(:yellow)} #{@todo.description}"
21
+ @todo.id
15
22
  end
23
+ end
16
24
 
17
- output += " (#{@todo.tags.join(', ')})".foreground(:green) unless @todo.tags.empty?
18
- output
25
+ def tags
26
+ return "" if @todo.tags.empty?
27
+ tags = " (#{@todo.tags.join(', ')})"
28
+ tags = tags.foreground(:green) unless @todo.status == :finished
29
+ tags
30
+ end
31
+
32
+ def mark_if_finished(output)
33
+ if @todo.status == :finished
34
+ output.foreground(:black)
35
+ else
36
+ output
37
+ end
19
38
  end
20
39
  end
data/lib/todo_void.rb CHANGED
@@ -27,7 +27,7 @@ class TodoVoid
27
27
  end
28
28
  @output
29
29
  end
30
-
30
+
31
31
  private
32
32
  def flag?(flag)
33
33
  @args[0] == flag
@@ -35,7 +35,7 @@ class TodoVoid
35
35
 
36
36
  def extract_tags(tag_arg)
37
37
  return [] unless tag_arg
38
-
38
+
39
39
  flag, tags = tag_arg.split("=")
40
40
  tags = tags.gsub("'", "")
41
41
  tags = tags.split(',')
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: todo-void
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
5
- prerelease:
4
+ version: 0.1.2.alpha
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Robert Curth
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-02 00:00:00.000000000 Z
12
+ date: 2012-08-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rainbow
@@ -104,13 +104,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
104
  requirements:
105
105
  - - ! '>='
106
106
  - !ruby/object:Gem::Version
107
- version: '0'
107
+ version: 1.9.2
108
108
  required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  none: false
110
110
  requirements:
111
- - - ! '>='
111
+ - - ! '>'
112
112
  - !ruby/object:Gem::Version
113
- version: '0'
113
+ version: 1.3.1
114
114
  requirements: []
115
115
  rubyforge_project:
116
116
  rubygems_version: 1.8.24