Module: Extension::Models::Specification::Features

Defined in:
lib/project_types/extension/models/specification.rb

Defined Under Namespace

Classes: Argo

Class Method Summary collapse

Class Method Details

.build(feature_set_attributes) ⇒ Object



18
19
20
21
22
23
24
25
26
27
# File 'lib/project_types/extension/models/specification.rb', line 18

def self.build(feature_set_attributes)
  feature_set_attributes.each_with_object(OpenStruct.new) do |(identifier, feature_attributes), feature_set|
    next if feature_attributes.nil?
    feature_set[identifier] = ShopifyCLI::ResolveConstant
      .call(identifier, namespace: Features)
      .rescue { OpenStruct }
      .then { |c| c.new(**feature_attributes) }
      .unwrap { |error| raise(error) }
  end
end