Class: ThingsController

Inherits:
Object
  • Object
show all
Defined in:
lib/things_templates/things_controller.rb

Class Method Summary collapse

Class Method Details

.add_item(item) ⇒ Object



3
4
5
6
# File 'lib/things_templates/things_controller.rb', line 3

def add_item(item)
  command = [base_command, add_item_command(item), end_command].join("\n")
  system(command)
end

.add_items_to_project(project, items, tags = nil) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/things_templates/things_controller.rb', line 16

def add_items_to_project(project, items, tags=nil)
  add_project(project) unless project_exists?(project)
  commands = [base_command]
  items.each do |item|
    commands << add_item_command(item, project, tags)
  end
  commands << end_command
  command = commands.join("\n")
  system(command)
end

.add_project(project) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/things_templates/things_controller.rb', line 8

def add_project(project)
  unless project_exists?(project)
    command_list = [base_command, add_project_command(project), end_command]
    command = command_list.join("\n")
    system(command)
  end
end