set history #push and #pop

This commit is contained in:
Kanezoh 2021-08-10 14:24:26 +09:00
parent c3f31f09bb
commit b23726d646

View File

@ -6,4 +6,19 @@ class MechanizeCr::History < Array(MechanizeCr::Page)
@max_size = max_size
super
end
def push(page, uri = nil)
super page
while self.size > @max_size
shift
end
self
end
def pop
if size == 0
# TODO: raise error
end
page = super
end
end