Class: RemoteRecord::Transformers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/remote_record/transformers/base.rb

Overview

Base transformer class. Inherit from this and implement ‘#transform`.

Direct Known Subclasses

SnakeCase

Instance Method Summary collapse

Constructor Details

#initialize(data, direction = :up) ⇒ Base

Returns a new instance of Base.

Raises:

  • (ArgumentError)


7
8
9
10
11
12
# File 'lib/remote_record/transformers/base.rb', line 7

def initialize(data, direction = :up)
  raise ArgumentError, 'The direction should be one of :up or :down.' unless %i[up down].include? direction

  @data = data
  @direction = direction
end

Instance Method Details

#transformObject

Raises:

  • (NotImplementedError)


14
15
16
# File 'lib/remote_record/transformers/base.rb', line 14

def transform
  raise NotImplementedError
end