Class: Jets::CLI::Curl::Adapter::Cookies::Jar
- Inherits:
-
Object
- Object
- Jets::CLI::Curl::Adapter::Cookies::Jar
- Includes:
- Util::Logging
- Defined in:
- lib/jets/cli/curl/adapter/cookies/jar.rb
Instance Method Summary collapse
-
#initialize(result, filename) ⇒ Jar
constructor
A new instance of Jar.
- #write_to_file ⇒ Object
Methods included from Util::Logging
Constructor Details
#initialize(result, filename) ⇒ Jar
Returns a new instance of Jar.
5 6 7 |
# File 'lib/jets/cli/curl/adapter/cookies/jar.rb', line 5 def initialize(result, filename) @result, @filename = result, filename end |
Instance Method Details
#write_to_file ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/jets/cli/curl/adapter/cookies/jar.rb', line 9 def write_to_file = @result[:cookies] if .nil? || .empty? log.debug "No cookies found in the result." return end File.open(@filename, "w") do |file| .each do || file.puts("# HTTP Cookie File") file.puts("# Created by jets curl #{Jets::VERSION}") file.puts("# Date: #{Time.now}\n\n") file.puts("#{}\n") end end log.debug "Cookies written to #{@filename}." end |