set history #push and #pop
parent
c3f31f09bb
commit
b23726d646
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue