Created
June 7, 2019 12:03
-
-
Save edlvj/8b7909ecabf630f9c788052b8338d0e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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