Class: Zopfli::Options
- Inherits:
-
Object
- Object
- Zopfli::Options
- Defined in:
- lib/zopfli/options.rb
Instance Attribute Summary collapse
-
#iterations ⇒ Object
readonly
Returns the value of attribute iterations.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #compress_pointer ⇒ Object
-
#initialize(type, iterations) ⇒ Options
constructor
A new instance of Options.
Constructor Details
#initialize(type, iterations) ⇒ Options
Returns a new instance of Options.
8 9 10 |
# File 'lib/zopfli/options.rb', line 8 def initialize(type, iterations) @type, @iterations = type, iterations end |
Instance Attribute Details
#iterations ⇒ Object (readonly)
Returns the value of attribute iterations.
6 7 8 |
# File 'lib/zopfli/options.rb', line 6 def iterations @iterations end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/zopfli/options.rb', line 6 def type @type end |
Instance Method Details
#compress_pointer ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/zopfli/options.rb', line 12 def compress_pointer = FFI::MemoryPointer.new :char, C::ZopfliConfig.size, false = C::ZopfliConfig.new # set format [:type] = case type when :deflate then 1 when :gzip then 2 else 0 end # set numiterations [:numiterations] = iterations.to_i if iterations.to_i > 0 end |