Class: EasySettings::KeyDSL
- Inherits:
-
Object
- Object
- EasySettings::KeyDSL
- Defined in:
- lib/redmine_extensions/easy_settings/key_dsl.rb
Overview
EasySettings::KeyDSL
For a comfortable way how to set new key via DSL
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #after_save(func = nil, &block) ⇒ Object
- #default(new_default) ⇒ Object
- #disabled_from_params ⇒ Object
- #from_params(func = nil, &block) ⇒ Object
-
#initialize ⇒ KeyDSL
constructor
A new instance of KeyDSL.
- #skip_blank_params ⇒ Object
- #type(new_type) ⇒ Object
- #validate(func = nil, &block) ⇒ Object
Constructor Details
#initialize ⇒ KeyDSL
Returns a new instance of KeyDSL.
11 12 13 |
# File 'lib/redmine_extensions/easy_settings/key_dsl.rb', line 11 def initialize @options = {} end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/redmine_extensions/easy_settings/key_dsl.rb', line 9 def @options end |
Instance Method Details
#after_save(func = nil, &block) ⇒ Object
39 40 41 |
# File 'lib/redmine_extensions/easy_settings/key_dsl.rb', line 39 def after_save(func=nil, &block) @options[:after_save] = func || block end |
#default(new_default) ⇒ Object
19 20 21 |
# File 'lib/redmine_extensions/easy_settings/key_dsl.rb', line 19 def default(new_default) @options[:default] = new_default end |
#disabled_from_params ⇒ Object
23 24 25 |
# File 'lib/redmine_extensions/easy_settings/key_dsl.rb', line 23 def disabled_from_params @options[:disabled_from_params] = true end |
#from_params(func = nil, &block) ⇒ Object
31 32 33 |
# File 'lib/redmine_extensions/easy_settings/key_dsl.rb', line 31 def from_params(func=nil, &block) @options[:from_params] = func || block end |
#skip_blank_params ⇒ Object
27 28 29 |
# File 'lib/redmine_extensions/easy_settings/key_dsl.rb', line 27 def skip_blank_params @options[:skip_blank_params] = true end |
#type(new_type) ⇒ Object
15 16 17 |
# File 'lib/redmine_extensions/easy_settings/key_dsl.rb', line 15 def type(new_type) @options[:type] = new_type end |
#validate(func = nil, &block) ⇒ Object
35 36 37 |
# File 'lib/redmine_extensions/easy_settings/key_dsl.rb', line 35 def validate(func=nil, &block) @options[:validate] = func || block end |