Sha256: 428f1b1ac0a878aad0e535ce7a7c0357f0b4e1b0926e4a0e5cb05ea2fe5c0806

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

module Kanoko
  module Application
    class Convert
      # You can make customize function.
      # It just make or overwhrite instance method.
      # example:
      #   class Kanoko::Application::Convert::Function
      #     # get "/new_func/new_value"
      #     # => add imagemagick option
      #     # -new-option new_value
      #     def new_func(arg)
      #       ['-new-option', arg]
      #     end
      #   end
      class Function
        class << self
          def list
            instance_methods(false)
          end
        end

        def crop(arg)
          [
            '-crop', arg
          ]
        end

        def fill(arg)
          [
            '-gravity', 'north',
            '-extent', arg,
            '-background', 'transparent',
          ]
        end

        def resize(arg)
          [
            '-define', "jpeg:size=#{arg}",
            '-thumbnail', arg,
          ]
        end

        def auto_orient
          [
            '-auto-orient'
          ]
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
kanoko-0.2.0 lib/kanoko/application/convert/function.rb
kanoko-0.1.3 lib/kanoko/application/convert/function.rb
kanoko-0.1.2 lib/kanoko/application/convert/function.rb
kanoko-0.1.1 lib/kanoko/application/convert/function.rb