From b3c4c466160c71e399eea039c21adb6fb7b496e0 Mon Sep 17 00:00:00 2001 From: Kanezoh Date: Tue, 16 Nov 2021 14:07:33 +0900 Subject: [PATCH] add history comment --- src/mechanize/history.cr | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mechanize/history.cr b/src/mechanize/history.cr index 6e1600b..9814694 100644 --- a/src/mechanize/history.cr +++ b/src/mechanize/history.cr @@ -1,6 +1,10 @@ require "./page" +# This class represents the history of http response you sent. +# If you send a request, mechanize saves the history. class MechanizeCr::History + # max page size history can save. default is 100. + # as same as `agent.max_history`. property max_size : Int32 property array : Array(MechanizeCr::Page) @@ -11,6 +15,7 @@ class MechanizeCr::History @array = array end + # add page to history. def push(page, uri = nil) @array.push(page) while size > @max_size @@ -19,6 +24,7 @@ class MechanizeCr::History self end + # take the last page out from history. def pop if size == 0 # TODO: raise error