set history #push and #pop

master
Kanezoh 2021-08-10 14:24:26 +09:00
parent c3f31f09bb
commit b23726d646
1 changed files with 15 additions and 0 deletions

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