Sha256: d8e211884964407c3f4482aae846c6df848a9b45ebc53e7804ef395194b5e5af

Contents?: true

Size: 785 Bytes

Versions: 9

Compression:

Stored size: 785 Bytes

Contents

# frozen_string_literal: true

module Maglev
  module Content
    module Builder
      TYPES = {
        text: Maglev::Content::Text,
        image: Maglev::Content::Image,
        link: Maglev::Content::Link,
        checkbox: Maglev::Content::Checkbox,
        color: Maglev::Content::Color,
        select: Maglev::Content::Select,
        collection_item: Maglev::Content::CollectionItem,
        icon: Maglev::Content::Icon,
        divider: Maglev::Content::Void,
        hint: Maglev::Content::Void
      }.freeze

      def build(scope, content, setting)
        klass = TYPES[setting.type.to_sym]

        raise "[Maglev] Unknown setting type: #{setting.type}" unless klass

        klass.new(scope, content, setting)
      end

      module_function :build
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
maglevcms-1.7.3 app/components/maglev/content/builder.rb
maglevcms-1.7.2 app/components/maglev/content/builder.rb
maglevcms-1.7.1 app/components/maglev/content/builder.rb
maglevcms-1.7.0 app/components/maglev/content/builder.rb
maglevcms-1.6.1 app/components/maglev/content/builder.rb
maglevcms-1.6.0 app/components/maglev/content/builder.rb
maglevcms-1.5.1 app/components/maglev/content/builder.rb
maglevcms-1.4.0 app/components/maglev/content/builder.rb
maglevcms-1.3.0 app/components/maglev/content/builder.rb