Class: BusinessCatalyst::CSV::TemplateIDTransformer

Inherits:
Transformer
  • Object
show all
Defined in:
lib/business_catalyst/csv/transformers.rb

Instance Attribute Summary

Attributes inherited from Transformer

#input

Instance Method Summary collapse

Methods inherited from Transformer

#initialize, transform

Constructor Details

This class inherits a constructor from BusinessCatalyst::CSV::Transformer

Instance Method Details

#transformObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/business_catalyst/csv/transformers.rb', line 39

def transform
  if input.kind_of?(Symbol)
    case input
    when :default
      0
    when :none
      -1
    when :parent
      -2
    else
      raise InvalidInputError, "#{input} is not a valid template ID"
    end
  else
    input
  end
end