class ArtirixDataModels::ModelFieldsDAO
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
Constants
- PARTIAL_FIELDS
Public Class Methods
new(dao_registry: nil, dao_registry_loader: nil, gateway: nil)
click to toggle source
# File lib/artirix_data_models/daos/model_fields_dao.rb, line 12 def initialize(dao_registry: nil, dao_registry_loader: nil, gateway: nil) set_dao_registry_and_loader dao_registry_loader, dao_registry @gateway = gateway end
Public Instance Methods
gateway()
click to toggle source
# File lib/artirix_data_models/daos/model_fields_dao.rb, line 17 def gateway @gateway ||= dao_registry.gateway end
partial_mode_fields_for(model_name)
click to toggle source
# File lib/artirix_data_models/daos/model_fields_dao.rb, line 21 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
Private Instance Methods
_get_partial(model_name)
click to toggle source
# File lib/artirix_data_models/daos/model_fields_dao.rb, line 31 def _get_partial(model_name) path = path_partial(model_name) gateway.get path rescue ArtirixDataModels::DataGateway::NotFound [] end
path_partial(model_name)
click to toggle source
# File lib/artirix_data_models/daos/model_fields_dao.rb, line 38 def path_partial(model_name) "/partial_fields/#{model_name}" end