Class: Action

Inherits:
Object
  • Object
show all
Extended by:
Abbreviations, Dependency::ClassMethod
Includes:
ActionInFile, ActionTextInProjectFile, Dependency::Methods, Status
Defined in:
lib/gtd.rb,
lib/action_persistence.rb

Constant Summary

Constants included from ActionInFile

ActionInFile::LINE_EXP

Constants included from Status

Status::ACTIVE_STATES, Status::INACTIVE_STATES, Status::STATUS_ORDER, Status::STATUS_SYMBOLS, Status::SYMBOLS_STATUS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Abbreviations

expand_text

Methods included from ActionInFile

#write

Methods included from ActionFileUtil

#file_name

Methods included from Status

#active, #directory_name, #inactive, #index, #symbol, #with_status

Methods included from ActionTextInProjectFile

#project_file_string

Constructor Details

#initialize(description, context, project = '', status = :unprocessed, info = '') ⇒ Action

Returns a new instance of Action.



194
195
196
197
198
199
200
201
# File 'lib/gtd.rb', line 194

def initialize (description,context,project='',status=:unprocessed,info='')
  @description = description.strip
  @context=context
  #@proposed_context
  @project=project
  @info=info
  @status = status
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



192
193
194
# File 'lib/gtd.rb', line 192

def context
  @context
end

#projectObject

Returns the value of attribute project.



192
193
194
# File 'lib/gtd.rb', line 192

def project
  @project
end

Class Method Details

.parse(line) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/action_persistence.rb', line 12

def Action::parse(line)
  begin
    action_details = {}
    line =~ LINE_EXP
    action_details[:description] = $3.strip
    action_details[:info] = $5 || ''
    action_details[:status] = SYMBOLS_STATUS[$1] || :unprocessed
    action_details[:context] = expand_text($2.strip)
  rescue
    log "Problem parsing #{line}"
    throw
  end
  #action = Action.new(description,context,nil,status,info)
  return action_details
end

Instance Method Details

#to_sObject



203
204
205
206
# File 'lib/gtd.rb', line 203

def to_s
  
  "#{@description} (#{@context.name}, #{@project.name}, #{status})"
end