Sha256: 05c6ab87630692e274de24c95b58ee1d52c6f8799ffc6fad9bb769fd44e972e1

Contents?: true

Size: 750 Bytes

Versions: 4

Compression:

Stored size: 750 Bytes

Contents

module Databound
  class Config
    def initialize(block, model)
      @model = model
      @permit = {}
      instance_eval(&block)
    end

    def columns(*specified_columns)
      @columns = specified_columns
    end

    def model(specified_model)
      raise ConfigError, "Model '#{@model}' already specified" if @model

      @model = specified_model
    end

    def permit(*methods, &block)
      methods.each do |method|
        @permit[method] = block
      end
    end

    def dsl(name, value, strict: true, &block)
      @stricts ||= {}
      @stricts[name] = strict

      @dsls ||= {}
      @dsls[name] ||= {}
      @dsls[name][value.to_s] = block
    end

    def read(name)
      instance_variable_get("@#{name}")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
databound-3.1.3 lib/databound/config.rb
databound-3.1.2 lib/databound/config.rb
databound-3.1.1 lib/databound/config.rb
databound-3.1.0 lib/databound/config.rb