Class: RabbitHole::Base

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

Instance Method Summary collapse

Constructor Details

#initialize(yml_path = "#{Dir.home}/.rabbit_hole.yml") ⇒ Base

Returns a new instance of Base.



7
8
9
# File 'lib/rabbit_hole/base.rb', line 7

def initialize(yml_path = "#{Dir.home}/.rabbit_hole.yml")
  @yml_path = yml_path
end

Instance Method Details

#popObject



17
18
19
20
21
# File 'lib/rabbit_hole/base.rb', line 17

def pop
  with_stack do |stack|
    stack.pop
  end
end

#push(task) ⇒ Object



11
12
13
14
15
# File 'lib/rabbit_hole/base.rb', line 11

def push(task)
  with_stack do |stack|
    stack.push(task)
  end
end

#sizeObject



29
30
31
32
33
# File 'lib/rabbit_hole/base.rb', line 29

def size
  with_stack do |stack|
    stack.size
  end
end

#tasksObject



35
36
37
38
39
# File 'lib/rabbit_hole/base.rb', line 35

def tasks
  with_stack do |stack|
    stack
  end
end

#topObject



23
24
25
26
27
# File 'lib/rabbit_hole/base.rb', line 23

def top
  with_stack do |stack|
    stack.last
  end
end