Class: Memo::Base
- Inherits:
-
Object
- Object
- Memo::Base
- Defined in:
- lib/memo/base.rb
Instance Method Summary collapse
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #pop ⇒ Object
- #push(arg) ⇒ Object
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
3 4 5 6 7 8 9 10 |
# File 'lib/memo/base.rb', line 3 def initialize home = ENV['HOME'] memo_dir = File.join(home, '.memo') @memo_file = File.join(home, '.memo/memos') @memo_stack = File.open(@memo_file, 'r').readlines create_memo_file! end |
Instance Method Details
#pop ⇒ Object
18 19 20 |
# File 'lib/memo/base.rb', line 18 def pop @memo_stack.pop end |
#push(arg) ⇒ Object
12 13 14 15 16 |
# File 'lib/memo/base.rb', line 12 def push(arg) File.open(@memo_file,'a') do |f| f.puts arg end end |