Class: Hanami::Model::Sql::Types::Schema::AssociationType Private

Inherits:
Types::Schema::CoercibleType show all
Defined in:
lib/hanami/model/sql/types.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Coercer for SQL associations target

Since:

  • 0.7.0

Instance Method Summary collapse

Methods inherited from Types::Schema::CoercibleType

#call, #coerce, #object

Instance Method Details

#success(*args) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.7.0


121
122
123
# File 'lib/hanami/model/sql/types.rb', line 121

def success(*args)
  result(Dry::Types::Result::Success, primitive.new(args.first.to_h))
end

#valid?(value) ⇒ TrueClass, FalseClass

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Check if value can be coerced

Parameters:

  • value (Object)

    the value

Returns:

  • (TrueClass, FalseClass)

    the result of the check

Since:

  • 0.7.0


115
116
117
# File 'lib/hanami/model/sql/types.rb', line 115

def valid?(value)
  value.inspect =~ /\[#{primitive}\]/ || super
end