cgriego/active_attr

View on GitHub
lib/active_attr/typecasting/object_typecaster.rb

Summary

Maintainability
A
0 mins
Test Coverage
module ActiveAttr
  module Typecasting
    # A "null" typecaster to provide uniformity
    #
    # @example Usage
    #   ObjectTypecaster.new.call("") #=> ""
    #
    # @since 0.5.0
    class ObjectTypecaster
      # Returns the original value unmodified
      #
      # @example Typecast an Object
      #   typecaster.call(1) #=> 1
      #
      # @param [Object] value The object to typecast
      #
      # @return [Object] Whatever you passed in
      #
      # @since 0.5.0
      def call(value)
        value
      end
    end
  end
end