Sha256: 011f68cd5db59b06a4a60e89494aecd74cb6061216eb7b3634548c34b2260eb1
Contents?: true
Size: 1.32 KB
Versions: 2
Compression:
Stored size: 1.32 KB
Contents
module Extension module Models class Specification include SmartProperties module Features class Argo include SmartProperties property! :surface, converts: :to_str property! :renderer_package_name, converts: :to_str property! :git_template, converts: :to_str property! :required_fields, accepts: Array, default: -> { [] } property! :required_shop_beta_flags, accepts: Array, default: -> { [] } end def self.build(feature_set_attributes) feature_set_attributes.each_with_object(OpenStruct.new) do |(identifier, feature_attributes), feature_set| feature_set[identifier] = ShopifyCli::ResolveConstant .call(identifier, namespace: Features) .rescue { OpenStruct } .then { |c| c.new(**feature_attributes) } .unwrap { |error| raise(error) } end end end property! :identifier property :name, converts: :to_str property :graphql_identifier, converts: :to_str property! :features, converts: Features.method(:build), default: -> { [] } property! :options, converts: ->(options) { OpenStruct.new(options) }, default: -> { OpenStruct.new } def graphql_identifier super || identifier end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shopify-cli-1.10.0 | lib/project_types/extension/models/specification.rb |
shopify-cli-1.9.1 | lib/project_types/extension/models/specification.rb |