class Tinify::Result
Attributes
data[R]
to_buffer[R]
Public Class Methods
new(meta, data)
click to toggle source
# File lib/tinify/result.rb, line 5 def initialize(meta, data) @meta, @data = meta.freeze, data.freeze end
Public Instance Methods
media_type()
click to toggle source
# File lib/tinify/result.rb, line 19 def media_type @meta["Content-Type"] end
Also aliased as: content_type
size()
click to toggle source
# File lib/tinify/result.rb, line 15 def size @meta["Content-Length"].to_i.nonzero? end
to_file(path)
click to toggle source
# File lib/tinify/result.rb, line 9 def to_file(path) File.open(path, "wb") { |file| file.write(data) } end