Skip to content

InitializationTypecaster #91

Description

@cgriego

A configurable typecaster that accepts an object that respond to #new and takes a single argument.

class InitializationTypecaster
  def initialize(type)
    @type = type
  end

  def call(value)
    type.new(value)
  end
end

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions