Class: Attached::Processor::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/attached/processor/base.rb

Direct Known Subclasses

Audio, Image

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, options = {}, attachment = nil) ⇒ Base

Create a processor.

Parameters:

  • file - The file to be processed.

  • options - The options to be applied to the processing.

  • attachment - The attachment the processor is being run for.



32
33
34
35
36
# File 'lib/attached/processor/base.rb', line 32

def initialize(file, options = {}, attachment = nil)
  @file = file
  @options = options
  @attachment = attachment
end

Instance Attribute Details

#attachmentObject

Returns the value of attribute attachment



8
9
10
# File 'lib/attached/processor/base.rb', line 8

def attachment
  @attachment
end

#fileObject

Returns the value of attribute file



6
7
8
# File 'lib/attached/processor/base.rb', line 6

def file
  @file
end

#optionsObject

Returns the value of attribute options



7
8
9
# File 'lib/attached/processor/base.rb', line 7

def options
  @options
end

Class Method Details

.process(file, options = {}, attachment = nil) ⇒ Object

Create and run a processor.

Parameters:

  • file - The file to be processed.

  • options - The options to be applied to the processing.

  • attachment - The attachment the processor is being run for.



19
20
21
# File 'lib/attached/processor/base.rb', line 19

def self.process(file, options = {}, attachment = nil)
  new(file, options, attachment).process
end

Instance Method Details

#processObject

Run the processor.

Raises:

  • (NotImplementedError)


41
42
43
# File 'lib/attached/processor/base.rb', line 41

def process
  raise NotImplementedError.new   
end