Class: Adminterface::Extensions::Inputs::Base::Pluginish::Config
- Inherits:
-
Object
- Object
- Adminterface::Extensions::Inputs::Base::Pluginish::Config
- Defined in:
- lib/adminterface/extensions/inputs/base/pluginish.rb
Instance Attribute Summary collapse
-
#configs ⇒ Object
readonly
Returns the value of attribute configs.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #attributes ⇒ Object
- #defaults ⇒ Object
- #enabled? ⇒ Boolean
-
#initialize(configs, options) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(configs, options) ⇒ Config
Returns a new instance of Config.
9 10 11 12 13 |
# File 'lib/adminterface/extensions/inputs/base/pluginish.rb', line 9 def initialize(configs, ) @name = configs[:name] @configs = configs @options = [@name.underscore.to_sym] end |
Instance Attribute Details
#configs ⇒ Object (readonly)
Returns the value of attribute configs.
7 8 9 |
# File 'lib/adminterface/extensions/inputs/base/pluginish.rb', line 7 def configs @configs end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/adminterface/extensions/inputs/base/pluginish.rb', line 7 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/adminterface/extensions/inputs/base/pluginish.rb', line 7 def @options end |
Instance Method Details
#attributes ⇒ Object
15 16 17 18 19 |
# File 'lib/adminterface/extensions/inputs/base/pluginish.rb', line 15 def attributes return {} unless enabled? {"aa-#{name}": .is_a?(Hash) ? : defaults} end |
#defaults ⇒ Object
21 22 23 |
# File 'lib/adminterface/extensions/inputs/base/pluginish.rb', line 21 def defaults @defaults ||= configs[:options] || {} end |
#enabled? ⇒ Boolean
25 26 27 28 |
# File 'lib/adminterface/extensions/inputs/base/pluginish.rb', line 25 def enabled? (!.eql?(false) && configs[:default].eql?(true)) || (.present? || .eql?(true)) end |