add max_history
This commit is contained in:
parent
900d5a419a
commit
d9eaef74bd
@ -101,4 +101,14 @@ class Mechanize
|
||||
def add_to_history(page)
|
||||
history.push(page)
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
require "./page"
|
||||
|
||||
class MechanizeCr::History < Array(MechanizeCr::Page)
|
||||
property :max_size
|
||||
property max_size : Int32
|
||||
def initialize(max_size = 100)
|
||||
@max_size = max_size
|
||||
super
|
||||
|
@ -53,6 +53,16 @@ module MechanizeCr
|
||||
@history.pop
|
||||
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)
|
||||
reset_request_header_cookies
|
||||
headers.each do |k,v|
|
||||
|
Loading…
Reference in New Issue
Block a user