Class: MarkdownExec::LinkHistory

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

Instance Method Summary collapse

Constructor Details

#initializeLinkHistory

Returns a new instance of LinkHistory.



98
99
100
# File 'lib/link_history.rb', line 98

def initialize
  @history = []
end

Instance Method Details

#peekObject

Peeks at the most recent LinkState, returns an empty LinkState if stack is empty.



103
104
105
# File 'lib/link_history.rb', line 103

def peek
  @history.last || LinkState.empty
end

#popObject

Pops the most recent LinkState off the stack, returns an empty LinkState if stack is empty.



108
109
110
# File 'lib/link_history.rb', line 108

def pop
  @history.pop || LinkState.empty
end

#prior_state_exist?Boolean

Returns:

  • (Boolean)


112
113
114
# File 'lib/link_history.rb', line 112

def prior_state_exist?
  peek.document_filename.present?
end

#push(link_state) ⇒ Object

Pushes a LinkState onto the stack.



117
118
119
# File 'lib/link_history.rb', line 117

def push(link_state)
  @history.push(link_state)
end