class Bronze::Transforms::Attributes::SymbolTransform

Transform class that converts a Symbol to a string.

Public Class Methods

instance() click to toggle source

@return [SymbolTransform] a memoized instance of SymbolTransform.

# File lib/bronze/transforms/attributes/symbol_transform.rb, line 10
def self.instance
  @instance ||= new
end

Public Instance Methods

denormalize(value) click to toggle source

Converts a normalized String to a Symbol.

@param value [String] The normalized string.

@return [Symbol] the denormalized symbol.

# File lib/bronze/transforms/attributes/symbol_transform.rb, line 19
def denormalize(value)
  return nil if value.nil?

  value.intern
end
normalize(value) click to toggle source

Converts a Symbol to a string.

@param value [Symbol] The Symbol to normalize.

@return [String] the string representation.

# File lib/bronze/transforms/attributes/symbol_transform.rb, line 30
def normalize(value)
  return nil if value.nil?

  value.to_s
end