Class: ProjectFromFile
- Defined in:
- lib/project_persistence.rb
Constant Summary
Constants included from Status
Status::ACTIVE_STATES, Status::INACTIVE_STATES, Status::STATUS_ORDER, Status::STATUS_SYMBOLS, Status::SYMBOLS_STATUS
Instance Attribute Summary
Attributes inherited from Context
Instance Method Summary collapse
-
#initialize(file_name, status) ⇒ ProjectFromFile
constructor
A new instance of ProjectFromFile.
- #read_actions ⇒ Object
Methods inherited from Project
Methods included from ProjectFileWriter
Methods included from Status
#active, #directory_name, #inactive, #index, #symbol, #with_status
Methods included from ObservingContainer
#<<, #dirty?, #set_dirty, #update
Methods inherited from Context
#<<, #delete, #include?, #to_s
Constructor Details
#initialize(file_name, status) ⇒ ProjectFromFile
Returns a new instance of ProjectFromFile.
5 6 7 8 |
# File 'lib/project_persistence.rb', line 5 def initialize(file_name,status) super(File.basename(file_name,'.prj'),status) @file_name = file_name end |
Instance Method Details
#read_actions ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/project_persistence.rb', line 9 def read_actions actions = [] infos = [] text=read_and_decode(@file_name) if text == nil then return {} end text.each_line do |line| line.strip! unless line.empty? then if line[0..0] == "#" then infos << line[2..-1] else action = Action.parse(line) action[:project] = self actions << action end end end {:actions=>actions, :infos=>infos} end |