Sha256: 3b997ecf058c9ce26b68573416a682b56bce37cddaee68820f9cf756212f4c8d

Contents?: true

Size: 499 Bytes

Versions: 22

Compression:

Stored size: 499 Bytes

Contents

module Workarea
  class Content
    class BlockTypeDefinition
      def self.define(&block)
        new.instance_eval(&block)
      end

      def block_type(name, &block)
        block_type = BlockType.new(name)

        if existing = BlockType.find(block_type.slug)
          existing.instance_eval(&block) if block_given?
        else
          block_type.instance_eval(&block) if block_given?
          Configuration::ContentBlocks.types.push(block_type)
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
workarea-core-3.5.6 app/models/workarea/content/block_type_definition.rb
workarea-core-3.5.5 app/models/workarea/content/block_type_definition.rb