Skip to content

Instantly share code, notes, and snippets.

@edlvj
Created June 7, 2019 12:03
Show Gist options
  • Save edlvj/8b7909ecabf630f9c788052b8338d0e2 to your computer and use it in GitHub Desktop.
Save edlvj/8b7909ecabf630f9c788052b8338d0e2 to your computer and use it in GitHub Desktop.
module BackUrls
extend ActiveSupport::Concern
class Stack
attr_reader :stack
def initialize(stack_storage)
@stack = stack_storage['back_urls'] ||= Array.new
end
def push(element)
return if element.blank?
@stack.push(element)
end
def pop
@stack.pop
end
def empty?
@stack.blank?
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment