Sha256: ab9ca3aa15e5a1ff056df0917effc0761d0222874c7317ee2b2fe6dc3da84155
Contents?: true
Size: 603 Bytes
Versions: 2
Compression:
Stored size: 603 Bytes
Contents
# frozen_string_literal: true module Granite module Form module Types class Object attr_reader :reflection, :owner, :type delegate :name, to: :reflection def initialize(type, reflection, owner) @type = type @reflection = reflection @owner = owner end def ensure_type(value) if value.instance_of?(type) value elsif !value.nil? typecast(value) end end def typecast(value) value if value.is_a?(type) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
granite-form-0.3.0 | lib/granite/form/types/object.rb |
granite-form-0.2.0 | lib/granite/form/types/object.rb |