Class: Trelloize

Inherits:
Object
  • Object
show all
Defined in:
lib/totrello/trelloize.rb

Overview

Trelloize

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(directory = Dir.pwd.to_s) ⇒ Trelloize

Returns a new instance of Trelloize.



10
11
12
13
14
# File 'lib/totrello/trelloize.rb', line 10

def initialize(directory = Dir.pwd.to_s)
  @trello = TrelloBuilder.new
  @directory = directory
  @config = TrelloConfig.new(directory)
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



8
9
10
# File 'lib/totrello/trelloize.rb', line 8

def config
  @config
end

#directoryObject

Returns the value of attribute directory.



8
9
10
# File 'lib/totrello/trelloize.rb', line 8

def directory
  @directory
end

#trelloObject

Returns the value of attribute trello.



8
9
10
# File 'lib/totrello/trelloize.rb', line 8

def trello
  @trello
end

Instance Method Details

#description(todo, config) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/totrello/trelloize.rb', line 16

def description(todo, config)
  return '' if todo.nil?
  out =  'TODO item found by the '
  out += "[ToTrello](https://rubygems.org/gems/totrello) gem\n"
  out += "**Project name:** #{config.project_name}\n"
  out += "**Filename**: #{todo[:file]}\n"
  out += "**Action item**: #{todo[:todo]}\n"
  out + "**Location (at or near) line**: #{todo[:line_number]}\n"
end

#find_and_create_cards_from_todos(todos, board) ⇒ Object



26
27
28
29
30
31
# File 'lib/totrello/trelloize.rb', line 26

def find_and_create_cards_from_todos(todos, board)
  todos.each do |todo|
    description = description(todo, @config)
    @trello.create_card(board, todo[:todo], description, @config.default_list)
  end
end