Class: JPEG2moro
- Inherits:
-
Object
- Object
- JPEG2moro
- Defined in:
- lib/jpeg2moro.rb
Constant Summary collapse
- DEBUG =
1
- VERSION =
"0.0.1"
- DEFAULT_ALPHA_DEPTH =
8
- DEFAULT_QUALITY =
70
Class Attribute Summary collapse
-
.debug ⇒ Object
Returns the value of attribute debug.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ JPEG2moro
constructor
A new instance of JPEG2moro.
-
#save(output_file, options = {}) ⇒ Object
save output_file with the given options.
- #to_s ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ JPEG2moro
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/jpeg2moro.rb', line 19 def initialize( = {}) if .kind_of?(Hash) @file = [:file] @data = [:data] else @file = end @data = File.read(@file) if @file debug "read %d bytes" % [@data.length] end |
Class Attribute Details
.debug ⇒ Object
Returns the value of attribute debug.
16 17 18 |
# File 'lib/jpeg2moro.rb', line 16 def debug @debug end |
Class Method Details
Instance Method Details
#save(output_file, options = {}) ⇒ Object
save output_file with the given options
40 41 42 43 |
# File 'lib/jpeg2moro.rb', line 40 def save(output_file, = {}) output = convert() File.open(output_file, "w") { |f| f.print output } end |
#to_s ⇒ Object
35 36 37 |
# File 'lib/jpeg2moro.rb', line 35 def to_s @data end |