Class: Neoneo::Category

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

Overview

Representation of No Kahuna’s categories for tasks

At the moment it’s a read-only class. So you can’t change the name of a category and then save those change. This is planned for future versions.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, name, project) ⇒ Category

Returns a new instance of Category.



377
378
379
380
381
# File 'lib/neoneo.rb', line 377

def initialize(id, name, project)
  @id      = id
  @name    = name
  @project = project
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



375
376
377
# File 'lib/neoneo.rb', line 375

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



375
376
377
# File 'lib/neoneo.rb', line 375

def name
  @name
end

Instance Method Details

#add_task(description, options = {}) ⇒ Object

Adds a task to this category

It works exactly as Project#add_task only with a pre-filled :category option. So please look there for further instructions on how to use it.



387
388
389
390
# File 'lib/neoneo.rb', line 387

def add_task(description, options = {})
  options[:category => self]
  @project.add_task(description, options)
end