Class: ArtirixDataModels::ModelFieldsDAO

Inherits:
Object
  • Object
show all
Defined in:
lib/artirix_data_models/daos/model_fields_dao.rb

Overview

DAO responsible for checking the fields list in both FULL and PARTIAL modes for a given model name.

It does so accessing the “fields list” entry point via the DataGateway

The Information should not change so it is stored in a constant Hash, so it’ll be accessed only once for each model and type

Constant Summary collapse

PARTIAL_FIELDS =
{}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gateway: nil) ⇒ ModelFieldsDAO

Returns a new instance of ModelFieldsDAO.



12
13
14
# File 'lib/artirix_data_models/daos/model_fields_dao.rb', line 12

def initialize(gateway: nil)
  @gateway = gateway || ArtirixDataModels::DAORegistry.gateway
end

Instance Attribute Details

#gatewayObject (readonly)

Returns the value of attribute gateway.



10
11
12
# File 'lib/artirix_data_models/daos/model_fields_dao.rb', line 10

def gateway
  @gateway
end

Instance Method Details

#partial_mode_fields_for(model_name) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/artirix_data_models/daos/model_fields_dao.rb', line 16

def partial_mode_fields_for(model_name)
  model_name = model_name.to_s

  PARTIAL_FIELDS.fetch(model_name) do
    PARTIAL_FIELDS[model_name] = _get_partial model_name
  end
end