Sha256: 1c9d3876c219525719c0cd75d3f00355dd8ddfc2976bdcfc333654cca3851f50

Contents?: true

Size: 781 Bytes

Versions: 41

Compression:

Stored size: 781 Bytes

Contents

module EasySettings
  ##
  # EasySettings::KeyDSL
  #
  # For a comfortable way how to set new key via DSL
  #
  class KeyDSL

    attr_reader :options

    def initialize
      @options = {}
    end

    def type(new_type)
      @options[:type] = new_type
    end

    def default(new_default)
      @options[:default] = new_default
    end

    def disabled_from_params
      @options[:disabled_from_params] = true
    end

    def skip_blank_params
      @options[:skip_blank_params] = true
    end

    def from_params(func=nil, &block)
      @options[:from_params] = func || block
    end

    def validate(func=nil, &block)
      @options[:validate] = func || block
    end

    def after_save(func=nil, &block)
      @options[:after_save] = func || block
    end

  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
redmine_extensions-1.2.0 lib/redmine_extensions/easy_settings/key_dsl.rb
redmine_extensions-1.1.2 lib/redmine_extensions/easy_settings/key_dsl.rb
redmine_extensions-1.1.1 lib/redmine_extensions/easy_settings/key_dsl.rb
redmine_extensions-1.1.0 lib/redmine_extensions/easy_settings/key_dsl.rb
redmine_extensions-1.0.0 lib/redmine_extensions/easy_settings/key_dsl.rb
redmine_extensions-0.6.3 lib/redmine_extensions/easy_settings/key_dsl.rb
redmine_extensions-0.6.2 lib/redmine_extensions/easy_settings/key_dsl.rb
redmine_extensions-0.6.1 lib/redmine_extensions/easy_settings/key_dsl.rb
redmine_extensions-0.6.0 lib/redmine_extensions/easy_settings/key_dsl.rb
redmine_extensions-0.4.5 lib/redmine_extensions/easy_settings/key_dsl.rb
redmine_extensions-0.5.1 lib/redmine_extensions/easy_settings/key_dsl.rb
redmine_extensions-0.4.4 lib/redmine_extensions/easy_settings/key_dsl.rb
redmine_extensions-0.4.3 lib/redmine_extensions/easy_settings/key_dsl.rb
redmine_extensions-0.4.1 lib/redmine_extensions/easy_settings/key_dsl.rb
redmine_extensions-0.4.0 lib/redmine_extensions/easy_settings/key_dsl.rb
redmine_extensions-0.4.0.beta lib/redmine_extensions/easy_settings/key_dsl.rb
redmine_extensions-0.3.11 lib/redmine_extensions/easy_settings/key_dsl.rb
redmine_extensions-0.3.10 lib/redmine_extensions/easy_settings/key_dsl.rb
redmine_extensions-0.3.9 lib/redmine_extensions/easy_settings/key_dsl.rb
redmine_extensions-0.3.8 lib/redmine_extensions/easy_settings/key_dsl.rb