Module: Extension::Messages::MessageLoading

Defined in:
lib/project_types/extension/messages/message_loading.rb

Class Method Summary collapse

Class Method Details

.loadObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/project_types/extension/messages/message_loading.rb', line 6

def self.load
  type_specific_messages = load_current_type_messages
  return Messages::MESSAGES if type_specific_messages.nil?

  if type_specific_messages.key?(:overrides)
    ShopifyCLI::Utilities.deep_merge(Messages::MESSAGES, type_specific_messages[:overrides])
  else
    Messages::MESSAGES
  end
end

.load_current_type_messagesObject



17
18
19
20
21
22
# File 'lib/project_types/extension/messages/message_loading.rb', line 17

def self.load_current_type_messages
  return unless ShopifyCLI::Project.has_current?
  messages_for_type(
    ShopifyCLI::Project.current.config[Extension::ExtensionProjectKeys::SPECIFICATION_IDENTIFIER_KEY]
  )
end

.messages_for_type(type_identifier) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/project_types/extension/messages/message_loading.rb', line 24

def self.messages_for_type(type_identifier)
  return if type_identifier.nil?

  type_identifier_symbol = type_identifier.downcase.to_sym
  return unless Messages::TYPES.key?(type_identifier_symbol)

  TYPES[type_identifier_symbol]
end