Class: ImageSqueeze::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/image_squeeze/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Result

Returns a new instance of Result.



5
6
7
8
9
10
# File 'lib/image_squeeze/result.rb', line 5

def initialize(options = {})
  @filename = options[:filename]
  @output_filename = options[:output_filename]
  @bytes_saved = options[:bytes_saved]
  @output_extension = options[:output_extension]
end

Instance Attribute Details

#bytes_savedObject (readonly)

Returns the value of attribute bytes_saved.



3
4
5
# File 'lib/image_squeeze/result.rb', line 3

def bytes_saved
  @bytes_saved
end

#filenameObject (readonly)

Returns the value of attribute filename.



3
4
5
# File 'lib/image_squeeze/result.rb', line 3

def filename
  @filename
end

#output_extensionObject (readonly)

Returns the value of attribute output_extension.



3
4
5
# File 'lib/image_squeeze/result.rb', line 3

def output_extension
  @output_extension
end

#output_filenameObject (readonly)

Returns the value of attribute output_filename.



3
4
5
# File 'lib/image_squeeze/result.rb', line 3

def output_filename
  @output_filename
end

Instance Method Details

#<=>(other) ⇒ Object



16
17
18
# File 'lib/image_squeeze/result.rb', line 16

def <=>(other)
  self.bytes_saved <=> other.bytes_saved
end

#optimized?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/image_squeeze/result.rb', line 12

def optimized?
  bytes_saved.to_i > 0
end