add @mech to page

master
Kanezoh 2021-07-05 14:15:05 +09:00
parent f2434a4c5a
commit a2bfdee1c8
3 changed files with 6 additions and 3 deletions

View File

@ -83,7 +83,7 @@ class Mechanize
def parse(uri, response, body)
code = response.not_nil!.status_code
MechanizeCr::Page.new(uri, response, body, code)
MechanizeCr::Page.new(uri, response, body, code, self)
end
def history

View File

@ -78,7 +78,7 @@ module MechanizeCr
end
private def response_parse(response, body, uri)
@context.not_nil!.parse uri, response, body
@context.not_nil!.parse(uri, response, body)
end
private def add_response_cookies(response, uri, page)

View File

@ -5,7 +5,10 @@ class MechanizeCr::Page < MechanizeCr::File
include MechanzeCr::ElementMatcher
delegate :css, to: parser
def initialize(uri, response, body, code)
property mech : Mechanize?
def initialize(uri, response, body, code, mech=nil)
@mech = mech
super(uri, response, body, code)
end