Class: Poleica::Converters::Coercive

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/poleica/converters/coercive.rb

Overview

The Coercive converter, it tries to coerce the polei

Constant Summary collapse

COMPATIBLE_TYPES =
[
  Types::All
]
TYPE_RETURNED_BY_METHOD =

TODO: Think about another way of declare return types

{
  to_pdf: Types::PDF,
  to_png: Types::Image,
  to_thumbnail: Types::Image
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#bin_path, exec_with_timeout, extract_extension_and_options, fail_if_error, #host_os, init_process_std, #linux?, map_std, #osx?, #underscorize, #windows?

Constructor Details

#initialize(polei) ⇒ Coercive

Returns a new instance of Coercive.



21
22
23
# File 'lib/poleica/converters/coercive.rb', line 21

def initialize(polei)
  @polei = polei
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object (private)



27
28
29
30
31
# File 'lib/poleica/converters/coercive.rb', line 27

def method_missing(method, *args, &block)
  extension, options = Utils.extract_extension_and_options(method, args)
  return try_convert(method, options) if extension
  super
end

Instance Attribute Details

#poleiObject (readonly)

Returns the value of attribute polei.



19
20
21
# File 'lib/poleica/converters/coercive.rb', line 19

def polei
  @polei
end