Halite::Options
Options class
Init with splats options
o = Options.new(
headers: {
user_agent: "foobar"
}
}
o.headers.class # => HTTP::Headers
o.cookies.class # => HTTP::Cookies
Set/Get timeout
Set it with connect_timeout/read_timeout/write_timeout keys,
but get it call Timeout class.
o = Options.new(connect_timeout: 30, read_timeout: 30)
o.timeout.connect # => 30.0
o.timeout.read # => 30.0
o.timeout.write # => nil
Set/Get follow
Set it with follow/follow_strict keys, but get it call Follow class.
o = Options.new(follow: 3, follow_strict: false)
o.follow.hops # => 3
o.follow.strict # => false
Constructors
Instance methods
Produces a shallow copy of obj—the instance variables of obj are copied, but not the objects they reference. dup copies the tainted state of obj.
Quick enable logging
By defaults, use Logging::Common as logging output.
Merge with other Options and return new Halite::Options
Returns Options self with given cookies combined.
Returns Options self with given cookies combined.
Returns Options self with given cookies combined.
Returns Options self with feature name and options.
Returns Options self with feature name and feature.
Returns Options self with feature name and options.
Returns Options self with given max hops of redirect times.
# Automatically following redirects
options.with_follow
# A maximum of 3 subsequent redirects
options.with_follow(3)
# Set subsequent redirects
options.with_follow(3)
Returns Options self with given headers combined.
Returns Options self with given logging, depend on with_features.
Returns Options iitself with given format and the options of format.
Returns Options self with given connect, read timeout.