Class: ResponseMate::Exporter

Inherits:
Object
  • Object
show all
Defined in:
lib/response_mate/exporter.rb

Overview

Responsible for exporting response_mate manifest to formats understood by other similar tools

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Exporter


7
8
9
10
11
12
# File 'lib/response_mate/exporter.rb', line 7

def initialize(args = {})
  @format      = args[:format]
  @manifest    = args[:manifest]
  @environment = args[:environment]
  @resource    = args[:resource]
end

Instance Attribute Details

#environmentObject

Returns the value of attribute environment


5
6
7
# File 'lib/response_mate/exporter.rb', line 5

def environment
  @environment
end

#formatObject

Returns the value of attribute format


5
6
7
# File 'lib/response_mate/exporter.rb', line 5

def format
  @format
end

#handlerObject

Returns the value of attribute handler


5
6
7
# File 'lib/response_mate/exporter.rb', line 5

def handler
  @handler
end

#manifestObject

Returns the value of attribute manifest


5
6
7
# File 'lib/response_mate/exporter.rb', line 5

def manifest
  @manifest
end

#resourceObject

Returns the value of attribute resource


5
6
7
# File 'lib/response_mate/exporter.rb', line 5

def resource
  @resource
end

Instance Method Details

#exportObject

Returns the compatible transformed resource


15
16
17
18
19
# File 'lib/response_mate/exporter.rb', line 15

def export
  @handler = "ResponseMate::Exporters::#{format.capitalize}".safe_constantize.
    new manifest, environment, resource
  handler.export
end