diff --git a/src/mechanize/history.cr b/src/mechanize/history.cr new file mode 100644 index 0000000..f002b2a --- /dev/null +++ b/src/mechanize/history.cr @@ -0,0 +1,9 @@ +require "./page" + +class MechanizeCr::History < Array(MechanizeCr::Page) + property :max_size + def initialize(max_size = 100) + @max_size = max_size + super + end +end diff --git a/src/mechanize/http/agent.cr b/src/mechanize/http/agent.cr index ecc7fe7..ec232a1 100644 --- a/src/mechanize/http/agent.cr +++ b/src/mechanize/http/agent.cr @@ -1,17 +1,18 @@ require "uri" require "http/client" require "../cookie" +require "../history" module MechanizeCr module HTTP class Agent property :request_headers, :context - property history : Array(Page) + property history : MechanizeCr::History property user_agent : String property request_cookies : ::HTTP::Cookies def initialize(@context : Mechanize | Nil = nil) - @history = Array(Page).new + @history = MechanizeCr::History.new @request_headers = ::HTTP::Headers.new @context = context @request_cookies = ::HTTP::Cookies.new