mechanize.cr/src/mechanize/history.cr

25 lines
374 B
Crystal
Raw Normal View History

2021-08-09 12:11:38 +02:00
require "./page"
class MechanizeCr::History < Array(MechanizeCr::Page)
2021-08-09 12:30:11 +02:00
property max_size : Int32
2021-08-09 12:11:38 +02:00
def initialize(max_size = 100)
@max_size = max_size
super
end
2021-08-10 07:24:26 +02:00
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
2021-08-09 12:11:38 +02:00
end