Class: ZtreningM::TodoFile
- Inherits:
-
Object
- Object
- ZtreningM::TodoFile
- Defined in:
- lib/ztrening.rb
Class Method Summary collapse
Class Method Details
.add(line) ⇒ Object
52 53 54 55 56 57 58 59 60 |
# File 'lib/ztrening.rb', line 52 def self.add line self.open! r=@todofile.add line if r==0 puts "Linija vec postoji!" elsif r==1 puts "Dodano!" end end |
.delete(line) ⇒ Object
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/ztrening.rb', line 62 def self.delete line self.open! if @todofile.find(line).empty? puts "Nema takve linije!" else @todofile.delete line @todofile.write! puts "Entry deleted!" end end |
.list ⇒ Object
73 74 75 76 77 78 79 |
# File 'lib/ztrening.rb', line 73 def self.list self.open! r=@todofile.lines.join "\n" if r.empty? "TODO list is empty!" else r end end |