Module: Biovision::Components::Base::ComponentParameters
- Included in:
- Biovision::Components::BaseComponent
- Defined in:
- app/lib/biovision/components/base/component_parameters.rb
Overview
Getting and setting component parameters
Instance Method Summary collapse
-
#[](key) ⇒ String
Receive parameter value or nil.
-
#[]=(key, value) ⇒ Object
Set parameter.
- #manage_settings? ⇒ Boolean
-
#receive(key, default = '') ⇒ String
Receive parameter value with default.
- #use_files? ⇒ Boolean
- #use_parameters? ⇒ Boolean
Instance Method Details
#[](key) ⇒ String
Receive parameter value or nil
Returns value of component’s parameter of nil when it’s not found
38 39 40 |
# File 'app/lib/biovision/components/base/component_parameters.rb', line 38 def [](key) @component.get(key, nil) end |
#[]=(key, value) ⇒ Object
Set parameter
46 47 48 49 50 51 |
# File 'app/lib/biovision/components/base/component_parameters.rb', line 46 def []=(key, value) return if key.blank? @component.parameters[key.to_s] = value @component.save! end |
#manage_settings? ⇒ Boolean
16 17 18 |
# File 'app/lib/biovision/components/base/component_parameters.rb', line 16 def manage_settings? use_parameters? || component.settings.any? end |
#receive(key, default = '') ⇒ String
Receive parameter value with default
Returns value of component’s parameter or default value when it’s not found
28 29 30 |
# File 'app/lib/biovision/components/base/component_parameters.rb', line 28 def receive(key, default = '') @component.get(key, default) end |
#use_files? ⇒ Boolean
12 13 14 |
# File 'app/lib/biovision/components/base/component_parameters.rb', line 12 def use_files? false end |
#use_parameters? ⇒ Boolean
8 9 10 |
# File 'app/lib/biovision/components/base/component_parameters.rb', line 8 def use_parameters? false end |