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
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#bin_path, exec_with_timeout, extract_extension_and_options, #host_os, #linux?, #osx?, set_process_stdout, #underscorize, #windows?

Constructor Details

#initialize(polei) ⇒ Coercive

Returns a new instance of Coercive.



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

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)



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

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.



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

def polei
  @polei
end