Module: Extension::Messages::MessageLoading
- Defined in:
- lib/project_types/extension/messages/message_loading.rb
Class Method Summary collapse
- .deep_merge(first, second) ⇒ Object
- .load ⇒ Object
- .load_current_type_messages ⇒ Object
- .messages_for_type(type_identifier) ⇒ Object
Class Method Details
.deep_merge(first, second) ⇒ Object
31 32 33 34 |
# File 'lib/project_types/extension/messages/message_loading.rb', line 31 def self.deep_merge(first, second) merger = proc { |_key, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 } first.merge(second, &merger) end |
.load ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/project_types/extension/messages/message_loading.rb', line 6 def self.load = return Messages::MESSAGES if .nil? if .key?(:overrides) deep_merge(Messages::MESSAGES, [:overrides]) else Messages::MESSAGES end end |
.load_current_type_messages ⇒ Object
17 18 19 20 |
# File 'lib/project_types/extension/messages/message_loading.rb', line 17 def self. return unless ShopifyCli::Project.has_current? (ShopifyCli::Project.current.config[Extension::ExtensionProjectKeys::EXTENSION_TYPE_KEY]) end |
.messages_for_type(type_identifier) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/project_types/extension/messages/message_loading.rb', line 22 def self.(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 |