Sha256: 35e43046a2e707989ea6bf01d7d6a9954efe12ef78c6faa6766232693160c723
Contents?: true
Size: 927 Bytes
Versions: 5
Compression:
Stored size: 927 Bytes
Contents
# frozen_string_literal: true module InferModel class Task FROMS = { csv: ::InferModel::From::CSV }.freeze TOS = { migration: ::InferModel::To::Migration, text: ::InferModel::To::Text, }.freeze attr_reader :from_object, :from_args, :from_opts, :to_object, :to_args, :to_opts def from(from_object, *args, **opts) @from_object = from_object @from_object = FROMS.fetch(from_object) if FROMS.key?(from_object) @from_args = args @from_opts = opts self end def to(to_object, *args, **opts) @to_object = to_object @to_object = TOS.fetch(to_object) if TOS.key?(to_object) @to_args = args @to_opts = opts self end def call to_object.call(from_object.call(*from_args, **from_opts), *to_args, **to_opts) end class << self def from(...) = new.from(...) def to(...) = new.to(...) end end end
Version data entries
5 entries across 5 versions & 1 rubygems