Sha256: 3152763983396e740bfc3295df9dba4dc7c13417acbcf421b70791527285d11e

Contents?: true

Size: 500 Bytes

Versions: 6

Compression:

Stored size: 500 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?
          Workarea.config.content_block_types.push(block_type)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
workarea-core-3.5.4 app/models/workarea/content/block_type_definition.rb
workarea-core-3.5.3 app/models/workarea/content/block_type_definition.rb
workarea-core-3.5.2 app/models/workarea/content/block_type_definition.rb
workarea-core-3.5.1 app/models/workarea/content/block_type_definition.rb
workarea-core-3.5.0 app/models/workarea/content/block_type_definition.rb
workarea-core-3.5.0.beta.1 app/models/workarea/content/block_type_definition.rb