Sha256: 119b8b53aa6a6f16112265f1bc1196eedd1bc0734bf9b84520e37c6003a88e34

Contents?: true

Size: 783 Bytes

Versions: 4

Compression:

Stored size: 783 Bytes

Contents

module StoreSchema::Module

  def self.included(base)
    base.extend(ClassMethods)
  end

  module ClassMethods

    # @example
    #
    #   # Gemfile
    #   gem "store_schema"
    #
    #   # app/models/project.rb
    #   class Website < ActiveRecord::Base
    #
    #     store_schema :config do |s|
    #       s.string :name
    #       s.integer :visitors
    #       s.float :apdex
    #       s.boolean :ssl
    #       s.datetime :published_at
    #     end
    #   end
    #
    # @param column [Symbol] name of the table column
    # @param block [Proc] the configuration block
    #
    def store_schema(column, &block)
      StoreSchema::Configuration.new(column).tap do |config|
        yield(config)
        config.send(:configure, self)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
store_schema-1.0.1 lib/store_schema/module.rb
store_schema-1.0.0 lib/store_schema/module.rb
store_schema-0.1.0 lib/store_schema/module.rb
store_schema-0.0.1 lib/store_schema/module.rb