Class: Hanami::Entity::Schema::Schemaless Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/entity/schema.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.

Schemaless entities logic

Since:

  • 0.7.0

Instance Method Summary collapse

Constructor Details

#initializeSchemaless

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.

Returns a new instance of Schemaless.

Since:

  • 0.7.0


62
63
64
# File 'lib/hanami/entity/schema.rb', line 62

def initialize
  freeze
end

Instance Method Details

#attribute?(_name) ⇒ Boolean

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.

Returns:

  • (Boolean)

Since:

  • 0.7.0


82
83
84
# File 'lib/hanami/entity/schema.rb', line 82

def attribute?(_name)
  true
end

#call(attributes) ⇒ Hash

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.

Parameters:

  • attributes (#to_hash)

    the attributes hash

Returns:

  • (Hash)

Since:

  • 0.7.0


72
73
74
75
76
77
78
# File 'lib/hanami/entity/schema.rb', line 72

def call(attributes)
  if attributes.nil?
    {}
  else
    Utils::Hash.deep_symbolize(attributes.to_hash.dup)
  end
end