add max_history
This commit is contained in:
parent
900d5a419a
commit
d9eaef74bd
@ -101,4 +101,14 @@ class Mechanize
|
|||||||
def add_to_history(page)
|
def add_to_history(page)
|
||||||
history.push(page)
|
history.push(page)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Get maximum number of items allowed in the history. The default setting is 100 pages.
|
||||||
|
def max_history
|
||||||
|
history.max_size
|
||||||
|
end
|
||||||
|
|
||||||
|
# Set maximum number of items allowed in the history.
|
||||||
|
def max_history=(length)
|
||||||
|
history.max_size = length
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
require "./page"
|
require "./page"
|
||||||
|
|
||||||
class MechanizeCr::History < Array(MechanizeCr::Page)
|
class MechanizeCr::History < Array(MechanizeCr::Page)
|
||||||
property :max_size
|
property max_size : Int32
|
||||||
def initialize(max_size = 100)
|
def initialize(max_size = 100)
|
||||||
@max_size = max_size
|
@max_size = max_size
|
||||||
super
|
super
|
||||||
|
@ -53,6 +53,16 @@ module MechanizeCr
|
|||||||
@history.pop
|
@history.pop
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Get maximum number of items allowed in the history. The default setting is 100 pages.
|
||||||
|
def max_history
|
||||||
|
@history.max_size
|
||||||
|
end
|
||||||
|
|
||||||
|
# Set maximum number of items allowed in the history.
|
||||||
|
def max_history=(length)
|
||||||
|
@history.max_size = length
|
||||||
|
end
|
||||||
|
|
||||||
private def set_request_headers(uri, headers)
|
private def set_request_headers(uri, headers)
|
||||||
reset_request_header_cookies
|
reset_request_header_cookies
|
||||||
headers.each do |k,v|
|
headers.each do |k,v|
|
||||||
|
Loading…
Reference in New Issue
Block a user