troo 0.0.4 → 0.0.5

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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/lib/troo/actions/create_board.rb +1 -1
  3. data/lib/troo/actions/create_card.rb +1 -1
  4. data/lib/troo/actions/create_comment.rb +1 -1
  5. data/lib/troo/actions/create_list.rb +1 -1
  6. data/lib/troo/cli/add_cli.rb +10 -10
  7. data/lib/troo/cli/cli_helpers.rb +34 -0
  8. data/lib/troo/cli/default_cli.rb +8 -22
  9. data/lib/troo/cli/main_cli.rb +52 -50
  10. data/lib/troo/cli/show_cli.rb +32 -51
  11. data/lib/troo/display/board_decorator.rb +4 -0
  12. data/lib/troo/display/board_presenter.rb +44 -38
  13. data/lib/troo/display/card_decorator.rb +8 -13
  14. data/lib/troo/display/card_presenter.rb +4 -4
  15. data/lib/troo/display/comment_decorator.rb +2 -1
  16. data/lib/troo/display/comment_presenter.rb +8 -12
  17. data/lib/troo/display/decorator_helpers.rb +8 -0
  18. data/lib/troo/display/list_decorator.rb +4 -0
  19. data/lib/troo/display/list_presenter.rb +18 -20
  20. data/lib/troo/display/member_decorator.rb +3 -2
  21. data/lib/troo/display/member_presenter.rb +4 -4
  22. data/lib/troo/external/board.rb +2 -2
  23. data/lib/troo/external/card.rb +1 -1
  24. data/lib/troo/external/comment.rb +1 -1
  25. data/lib/troo/external/list.rb +1 -1
  26. data/lib/troo/external/member.rb +1 -1
  27. data/lib/troo/models/board.rb +12 -0
  28. data/lib/troo/models/card.rb +14 -2
  29. data/lib/troo/models/comment.rb +7 -3
  30. data/lib/troo/models/list.rb +13 -1
  31. data/lib/troo/models/member.rb +8 -0
  32. data/lib/troo/troo.rb +1 -1
  33. data/lib/troo/version.rb +1 -1
  34. data/test/lib/troo/actions/create_board_test.rb +1 -1
  35. data/test/lib/troo/actions/create_card_test.rb +1 -1
  36. data/test/lib/troo/actions/create_comment_test.rb +1 -1
  37. data/test/lib/troo/actions/create_list_test.rb +1 -1
  38. data/test/lib/troo/cli/add_cli_test.rb +18 -18
  39. data/test/lib/troo/cli/{thor_fixes_test.rb → cli_helpers_test.rb} +3 -0
  40. data/test/lib/troo/cli/default_cli_test.rb +6 -6
  41. data/test/lib/troo/cli/main_cli_test.rb +22 -20
  42. data/test/lib/troo/cli/show_cli_test.rb +57 -27
  43. data/test/lib/troo/display/board_decorator_test.rb +2 -2
  44. data/test/lib/troo/display/board_presenter_test.rb +2 -2
  45. data/test/lib/troo/display/card_decorator_test.rb +6 -14
  46. data/test/lib/troo/display/card_presenter_test.rb +2 -2
  47. data/test/lib/troo/display/comment_decorator_test.rb +6 -1
  48. data/test/lib/troo/display/comment_presenter_test.rb +2 -2
  49. data/test/lib/troo/display/decorator_helpers_test.rb +21 -1
  50. data/test/lib/troo/display/list_presenter_test.rb +2 -2
  51. data/test/lib/troo/display/member_decorator_test.rb +6 -1
  52. data/test/lib/troo/display/member_presenter_test.rb +2 -2
  53. metadata +6 -6
  54. data/lib/troo/cli/thor_fixes.rb +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4196fd2c2819ea9e6444d5095a58d98de11f2b97
4
- data.tar.gz: 27e689c2d9d704d975e22fcb8706e15301ec4788
3
+ metadata.gz: e1de45a5c35b2b5698fcbc2770107afc4a778f3b
4
+ data.tar.gz: 5bf9a0b9ea0fabdf6f5f13ec79574b7cdbedefc2
5
5
  SHA512:
6
- metadata.gz: 1b753a287582cb83a7ef43e8f2ca55adfbb69025eee8c756acb55a5c2df42b3dc1b25fe976d96faa50be0b184efdda23e5582cd7bea6fc75124e72eb33753a0a
7
- data.tar.gz: 99a457435748022541e62d94a4cfc6c9ba1d4ccc934946313318fd646f7eb40efbe9e94131631b49ce384523aa22e82791d294a3cc6b7d9793ed8686ffcfd320
6
+ metadata.gz: b6717b3614403eca4d24879498a8d4219e3f48383c071b4875b7fa144fdebe02141de7bc75e7d39f563c4fd90b0377af3adda9f48c020b4efc275f7cfecdd035
7
+ data.tar.gz: 8e49b3e4758f173266b0b3fb91e2af0bd70994652a4c6e9f9dbd4c39c6d87e75ecc0a7f52071511ea6e93ccc21b8bb98fad7ada2de4acb80e4437fb75e85704d
@@ -21,7 +21,7 @@ module Troo
21
21
  attr_reader :name, :description
22
22
 
23
23
  def update_boards
24
- return Troo::BoardPersistence.for(create_board) if create_board
24
+ return BoardPersistence.for(create_board) if create_board
25
25
  false
26
26
  end
27
27
 
@@ -20,7 +20,7 @@ module Troo
20
20
  attr_reader :list, :name, :description
21
21
 
22
22
  def update_cards
23
- return Troo::CardPersistence.for(create_card) if create_card
23
+ return CardPersistence.for(create_card) if create_card
24
24
  false
25
25
  end
26
26
 
@@ -19,7 +19,7 @@ module Troo
19
19
  attr_reader :card, :comment
20
20
 
21
21
  def update_comments
22
- return Troo::CommentPersistence.for(parsed_json_response) if parsed_json_response
22
+ return CommentPersistence.for(parsed_json_response) if parsed_json_response
23
23
  false
24
24
  end
25
25
 
@@ -19,7 +19,7 @@ module Troo
19
19
  attr_reader :board, :name
20
20
 
21
21
  def update_lists
22
- return Troo::ListPersistence.for(create_list) if create_list
22
+ return ListPersistence.for(create_list) if create_list
23
23
  false
24
24
  end
25
25
 
@@ -10,8 +10,8 @@ module Troo
10
10
  name = ask("Please enter a name for this board:")
11
11
  end
12
12
 
13
- if result = Troo::CreateBoard.with(name, description)
14
- say "New board '#{result.name}' created."
13
+ if result = CreateBoard.with(name, description)
14
+ say "New board '#{result.decorator.name}' created."
15
15
  else
16
16
  say "Board could not be created."
17
17
  end
@@ -26,9 +26,9 @@ module Troo
26
26
  name = ask("Please enter a name for this card:")
27
27
  end
28
28
 
29
- if list = Troo::ListRetrieval.retrieve(list_id)
30
- if result = Troo::CreateCard.for(list, name, description)
31
- say "New card '#{result.name}' created."
29
+ if list = ListRetrieval.retrieve(list_id)
30
+ if result = CreateCard.for(list, name, description)
31
+ say "New card '#{result.decorator.name}' created."
32
32
  else
33
33
  say "Card could not be created."
34
34
  end
@@ -46,8 +46,8 @@ module Troo
46
46
  comment = ask("Please enter a comment:")
47
47
  end
48
48
 
49
- if card = Troo::CardRetrieval.retrieve(card_id)
50
- if Troo::CreateComment.for(card, comment)
49
+ if card = CardRetrieval.retrieve(card_id)
50
+ if CreateComment.for(card, comment)
51
51
  say "New comment created."
52
52
  else
53
53
  say "Comment could not be created."
@@ -66,9 +66,9 @@ module Troo
66
66
  name = ask("Please enter a name for this list:")
67
67
  end
68
68
 
69
- if board = Troo::BoardRetrieval.retrieve(board_id)
70
- if result = Troo::CreateList.for(board, name)
71
- say "New list '#{result.name}' created."
69
+ if board = BoardRetrieval.retrieve(board_id)
70
+ if result = CreateList.for(board, name)
71
+ say "New list '#{result.decorator.name}' created."
72
72
  else
73
73
  say "List could not be created."
74
74
  end
@@ -0,0 +1,34 @@
1
+ module Troo
2
+ module CLI
3
+ module Helpers
4
+ def set_default
5
+ return success if resource && resource.set_default!
6
+ not_found
7
+ end
8
+
9
+ def success
10
+ say "'#{resource.decorator.name}' set as default #{type.to_s.downcase}."
11
+ true
12
+ end
13
+
14
+ def not_found
15
+ say "#{type.to_s.capitalize} cannot be found. Specify a different <id> or use 'troo default #{type.to_s} <id>' to set a default #{type.to_s} first."
16
+ false
17
+ end
18
+
19
+ def resource
20
+ @resource = case type
21
+ when :board then @board ||= BoardRetrieval.retrieve(id)
22
+ when :list then @list ||= ListRetrieval.retrieve(id)
23
+ when :card then @card ||= CardRetrieval.retrieve(id)
24
+ end
25
+ end
26
+ end
27
+
28
+ class ThorFixes < Thor
29
+ def self.banner(command, namespace = nil, subcommand = false)
30
+ "#{basename} #{@package_name} #{command.usage}"
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,45 +1,31 @@
1
1
  module Troo
2
2
  module CLI
3
3
  class Default < ThorFixes
4
+ include Helpers
5
+
4
6
  package_name "default"
5
7
 
6
8
  desc "board <id>", "Set the board <id> to default."
7
9
  def board(id)
8
- set_default(id, :board)
10
+ initialize_and_dispatch(id, :board)
9
11
  end
10
12
 
11
13
  desc "card <id>", "Set the card <id> to default."
12
14
  def card(id)
13
- set_default(id, :card)
15
+ initialize_and_dispatch(id, :card)
14
16
  end
15
17
 
16
18
  desc "list <id>", "Set the list <id> to default."
17
19
  def list(id)
18
- set_default(id, :list)
20
+ initialize_and_dispatch(id, :list)
19
21
  end
20
22
 
21
23
  private
24
+ attr_reader :id, :type
22
25
 
23
- def set_default(id, type)
26
+ def initialize_and_dispatch(id, type)
24
27
  @id, @type = id, type
25
- return success(resource.name) if SetDefault.for(resource)
26
- not_found
27
- end
28
-
29
- def resource
30
- @resource ||= case @type
31
- when :board then Troo::BoardRetrieval.retrieve(@id)
32
- when :list then Troo::ListRetrieval.retrieve(@id)
33
- when :card then Troo::CardRetrieval.retrieve(@id)
34
- end
35
- end
36
-
37
- def success(resource_name = "")
38
- say "'#{resource_name}' set as default #{@type.to_s.downcase}."
39
- end
40
-
41
- def not_found
42
- say "#{@type.to_s.capitalize} cannot be found."
28
+ set_default
43
29
  end
44
30
  end
45
31
  end
@@ -1,62 +1,23 @@
1
1
  module Troo
2
2
  module CLI
3
3
  class Main < ThorFixes
4
+ include Helpers
5
+
4
6
  default_task :status
5
7
 
6
8
  class_option :debug, type: :boolean, desc: "Enable debugging."
7
9
 
8
10
  desc "status", "Get troo status."
9
11
  def status
10
- board_count = Troo::Board.count
11
- list_count = Troo::List.count
12
- card_count = Troo::Card.count
13
-
14
- if board_count > 0
15
- if board = Troo::BoardRetrieval.default
16
- say "Board: #{BoardDecorator.new(board).short}"
17
- else
18
- say "Board: No default set."
19
- end
20
- else
21
- say "No local board data."
22
- end
23
-
24
- if list_count > 0
25
- if list = Troo::ListRetrieval.default
26
- say "List: #{ListDecorator.new(list).short}"
27
- else
28
- say "List: No default set."
29
- end
30
- else
31
- say "No local list data."
32
- end
33
-
34
- if card_count > 0
35
- if card = Troo::CardRetrieval.default
36
- say "Card: #{CardDecorator.new(card).short}"
37
- else
38
- say "Card: No default set."
39
- end
40
- else
41
- say "No local card data."
42
- end
43
-
44
- puts [plural(board_count, "board"),
45
- plural(list_count, "list"),
46
- plural(card_count, "card") ].join(", ")
47
- puts
12
+ say "Status:"
13
+ get_status(:board)
14
+ get_status(:list)
15
+ get_status(:card)
16
+ say ""
48
17
 
49
18
  help
50
19
  end
51
20
 
52
- private
53
-
54
- def plural(size, singular)
55
- (size == 1) ? "#{size} #{singular}" : "#{size} #{singular}s"
56
- end
57
-
58
- public
59
-
60
21
  desc "refresh", "Refresh all data for default board."
61
22
  method_option :all, type: :boolean, desc: "Refresh all boards, lists, cards and comments."
62
23
  method_option :lists, type: :boolean, desc: "Refresh all lists for default board."
@@ -66,7 +27,7 @@ module Troo
66
27
  RefreshAll.all(nil, options)
67
28
  say "All local data has been refreshed."
68
29
  else
69
- if board = Troo::BoardRetrieval.default
30
+ if board = BoardRetrieval.default
70
31
  if options["lists"]
71
32
  RefreshAll.lists(board, options)
72
33
  say "All lists for the default board have been refreshed."
@@ -109,10 +70,10 @@ module Troo
109
70
 
110
71
  desc "move <card_id> <list_id>", "Move a card <card_id> to list <list_id>."
111
72
  def move(card_id, list_id)
112
- if card = Troo::CardRetrieval.retrieve(card_id)
113
- if list = Troo::ListRetrieval.retrieve(list_id)
73
+ if card = CardRetrieval.retrieve(card_id)
74
+ if list = ListRetrieval.retrieve(list_id)
114
75
  if result = MoveCard.with(card, list)
115
- say "Card moved from '#{card.list.name}' to '#{list.name}'."
76
+ say "Card moved from '#{card.list.decorator.name}' to '#{list.decorator.name}'."
116
77
  else
117
78
  say "Card could not be moved."
118
79
  end
@@ -125,6 +86,47 @@ module Troo
125
86
  rescue Troo::InvalidAccessToken
126
87
  say "Your Trello access credentials have expired, please renew and try again."
127
88
  end
89
+
90
+ private
91
+ attr_reader :id, :type
92
+
93
+ def get_status(type)
94
+ @id, @type = nil, type
95
+ return show if resource_found && resource
96
+ return no_default_found if resource_count > 0
97
+ end
98
+
99
+ def resource_found
100
+ label = " #{type.to_s.capitalize}s:".ljust(10)
101
+ say label + plural(resource_count, type.to_s) + " found."
102
+ end
103
+
104
+ def resource_count
105
+ @count = case type
106
+ when :board then Troo::Board.count
107
+ when :list then Troo::List.count
108
+ when :card then Troo::Card.count
109
+ end
110
+ end
111
+
112
+ def show
113
+ say " #{resource.decorator.title}"
114
+ end
115
+
116
+ def no_default_found
117
+ say " " + Esc.red + "No default #{type} set." + Esc.reset
118
+ end
119
+
120
+ def plural(size, singular)
121
+ pluralized = singular + "s"
122
+ if size == 0
123
+ "No #{pluralized}"
124
+ elsif size == 1
125
+ "#{size} #{singular}"
126
+ else
127
+ "#{size} #{pluralized}"
128
+ end
129
+ end
128
130
  end
129
131
  end
130
132
  end
@@ -1,11 +1,13 @@
1
1
  module Troo
2
2
  module CLI
3
3
  class Show < ThorFixes
4
+ include Helpers
5
+
4
6
  package_name "show"
5
7
 
6
8
  desc "boards", "Show all the boards with lists."
7
9
  def boards
8
- boards = Troo::BoardRetrieval.all
10
+ boards = BoardRetrieval.all
9
11
  if boards.any?
10
12
  boards.map do |board|
11
13
  BoardPresenter.render_all(board)
@@ -15,69 +17,48 @@ module Troo
15
17
  end
16
18
  end
17
19
 
18
- desc "board (<board_id>)", "Show lists and cards for board <board_id> (uses default board if <board_id> not provided)."
19
- def board(board_id = nil)
20
- if board = Troo::BoardRetrieval.retrieve(board_id)
21
- if SetDefault.for(board)
22
- say "'#{board.name}' set to default."
23
- end
24
- BoardPresenter.render_show(board)
25
- else
26
- if board_id
27
- say "Board not found."
28
- else
29
- say "Specify a <board_id> or use 'troo default board <board_id>' to set a default board first."
30
- end
31
- end
20
+ desc "board (<id>)", "Show lists and cards for board <id> (uses default board if <id> not provided)."
21
+ def board(id = nil)
22
+ initialize_and_dispatch(id, :board)
32
23
  end
33
24
 
34
- desc "list (<list_id>)", "Show all cards for list <list_id> (uses default list if <list_id> not provided)."
35
- def list(list_id = nil)
36
- if list = Troo::ListRetrieval.retrieve(list_id)
37
- if SetDefault.for(list)
38
- say "'#{list.name}' set to default."
39
- end
40
- ListPresenter.render_show(list)
41
- else
42
- if list_id
43
- say "List not found."
44
- else
45
- say "Specify a <list_id> or use 'troo default list <list_id>' to set a default list first."
46
- end
47
- end
25
+ desc "list (<id>)", "Show all cards for list <id> (uses default list if <id> not provided)."
26
+ def list(id = nil)
27
+ initialize_and_dispatch(id, :list)
48
28
  end
49
29
 
50
- desc "card (<card_id>)", "Show a card including latest 3 comments for card <card_id> (uses default card if <card_id> not provided)."
51
- def card(card_id = nil)
52
- if card = Troo::CardRetrieval.retrieve(card_id)
53
- if SetDefault.for(card)
54
- say "'#{card.name}' set to default."
55
- end
56
- CardPresenter.render_show(card)
57
- else
58
- if card_id
59
- say "Card not found."
60
- else
61
- say "Specify a <card_id> or use 'troo default card <card_id>' to set a default card first."
62
- end
63
- end
30
+ desc "card (<id>)", "Show a card including latest 3 comments for card <id> (uses default card if <id> not provided)."
31
+ def card(id = nil)
32
+ initialize_and_dispatch(id, :card)
64
33
  end
65
34
 
66
- desc "comments (<card_id>)", "Show all comments for card <card_id> (uses default card if <card_id> not provided)."
67
- def comments(card_id = nil)
68
- if card = Troo::CardRetrieval.retrieve(card_id)
35
+ desc "comments (<id>)", "Show all comments for card <id> (uses default card if <id> not provided)."
36
+ def comments(id = nil)
37
+ if card = CardRetrieval.retrieve(id)
69
38
  if SetDefault.for(card)
70
- say "'#{card.name}' set to default."
39
+ say "'#{card.decorator.name}' set to default."
71
40
  end
72
- CommentPresenter.render_show(card)
41
+ CommentPresenter.show(card)
73
42
  else
74
- if card_id
75
- say "Card not found."
43
+ if id
44
+ say "Card cannot be found."
76
45
  else
77
- say "Specify a <card_id> or use 'troo default card <card_id>' to set a default card first."
46
+ say "Specify a <id> or use 'troo default card <id>' to set a default card first."
78
47
  end
79
48
  end
80
49
  end
50
+
51
+ private
52
+ attr_reader :id, :type
53
+
54
+ def initialize_and_dispatch(id, type)
55
+ @id, @type = id, type
56
+ show_resource
57
+ end
58
+
59
+ def show_resource
60
+ resource.presenter.show if set_default
61
+ end
81
62
  end
82
63
  end
83
64
  end
@@ -40,6 +40,10 @@ module Troo
40
40
  board.id.to_s
41
41
  end
42
42
 
43
+ def lists(alt_options = {})
44
+ board.lists.map { |list| list.decorator(alt_options) }
45
+ end
46
+
43
47
  private
44
48
  attr_reader :board
45
49
 
@@ -5,8 +5,8 @@ module Troo
5
5
  new(board, options).render_all
6
6
  end
7
7
 
8
- def render_show(board, options = {})
9
- new(board, options).render_show
8
+ def show(board, options = {})
9
+ new(board, options).show
10
10
  end
11
11
  end
12
12
 
@@ -18,48 +18,54 @@ module Troo
18
18
  end
19
19
 
20
20
  def render_all
21
- spacing({foot: false}) do
22
- print BoardDecorator.new(board).short
23
-
24
- if board.lists.any?
25
- board.lists.each do |list|
26
- indent do
27
- print ListDecorator.new(list).short
28
- end
29
- end
30
- else
31
- print_error "No lists were found.\n"
21
+ puts board.decorator.title
22
+
23
+ print_error "No lists were found." if lists.empty?
24
+
25
+ print_lists
26
+ end
27
+
28
+ def show
29
+ puts board.decorator.title
30
+
31
+ print_error "No lists were found." if lists.empty?
32
+
33
+ print_lists_with_cards
34
+ end
35
+
36
+ private
37
+ attr_reader :board
38
+
39
+ def print_lists_with_cards
40
+ lists.each do |list|
41
+ title_for(list)
42
+
43
+ print_error "No cards were found." if list.cards.empty?
44
+
45
+ list.cards(unformatted).each do |card|
46
+ title_for(card)
32
47
  end
33
48
  end
49
+ puts
34
50
  end
35
51
 
36
- def render_show
37
- spacing do
38
- print BoardDecorator.new(board).short
39
-
40
- if board.lists.any?
41
- board.lists.each do |list|
42
- indent do
43
- print ListDecorator.new(list).short
44
-
45
- if list.cards.any?
46
- list.cards.each do |card|
47
- indent do
48
- print CardDecorator.new(card).short
49
- end
50
- end
51
- else
52
- print_error "No cards were found."
53
- end
54
- end
55
- end
56
- else
57
- print_error "No lists were found."
58
- end
52
+ def print_lists
53
+ lists.each do |list|
54
+ title_for(list)
59
55
  end
56
+ puts
60
57
  end
61
58
 
62
- private
63
- attr_reader :board
59
+ def lists
60
+ board.decorator.lists
61
+ end
62
+
63
+ def unformatted
64
+ {
65
+ ansicolor: false,
66
+ colour: nil,
67
+ underline: nil
68
+ }
69
+ end
64
70
  end
65
71
  end
@@ -11,11 +11,6 @@ module Troo
11
11
  [default_str, id_str, name_str].join + "\n"
12
12
  end
13
13
 
14
- def title
15
- title_options = { ansicolor: true, colour: Esc.green, underline: Esc.underline }
16
- highlight([default, brackets(id), name].join(" "), title_options)
17
- end
18
-
19
14
  def name_str
20
15
  highlight(name, options)
21
16
  end
@@ -61,7 +56,7 @@ module Troo
61
56
 
62
57
  def members
63
58
  if card.members.any?
64
- MemberPresenter.new(card).render_show
59
+ MemberPresenter.new(card).show
65
60
  else
66
61
  "No members have been assigned."
67
62
  end
@@ -72,11 +67,11 @@ module Troo
72
67
  end
73
68
 
74
69
  def board
75
- BoardDecorator.new(card.board, options).short
70
+ card.board.decorator(options).short
76
71
  end
77
72
 
78
73
  def list
79
- ListDecorator.new(card.list, options).short
74
+ card.list.decorator(options).short
80
75
  end
81
76
 
82
77
  private
@@ -88,18 +83,18 @@ module Troo
88
83
 
89
84
  def defaults
90
85
  {
91
- ansicolor: false,
92
- colour: nil,
93
- underline: nil
86
+ ansicolor: true,
87
+ colour: Esc.magenta,
88
+ underline: Esc.underline
94
89
  }
95
90
  end
96
91
 
97
92
  def decorated_recent_comments
98
- card.recent_comments.map { |comment| CommentDecorator.new(comment).as_view }.join
93
+ card.recent_comments.map { |comment| comment.decorator.as_view }.join
99
94
  end
100
95
 
101
96
  def decorated_all_comments
102
- card.comments.map { |comment| CommentDecorator.new(comment).as_view }.join
97
+ card.comments.map { |comment| comment.decorator.as_view }.join
103
98
  end
104
99
  end
105
100
  end
@@ -1,8 +1,8 @@
1
1
  module Troo
2
2
  class CardPresenter
3
3
  class << self
4
- def render_show(card, options = {})
5
- new(card, options).render_show
4
+ def show(card, options = {})
5
+ new(card, options).show
6
6
  end
7
7
  end
8
8
 
@@ -13,7 +13,7 @@ module Troo
13
13
  @options = options
14
14
  end
15
15
 
16
- def render_show
16
+ def show
17
17
  print Template.parse(decorated_card, "/../views/card.erb")
18
18
  end
19
19
 
@@ -21,7 +21,7 @@ module Troo
21
21
  attr_reader :card
22
22
 
23
23
  def decorated_card
24
- @decorated_card ||= CardDecorator.new(card)
24
+ @decorated_card ||= card.decorator
25
25
  end
26
26
  end
27
27
  end
@@ -2,8 +2,9 @@ module Troo
2
2
  class CommentDecorator
3
3
  include DecoratorHelpers
4
4
 
5
- def initialize(comment)
5
+ def initialize(comment, options = {})
6
6
  @comment = comment
7
+ @options = options
7
8
  end
8
9
 
9
10
  def as_view