Module: Cockpit::Helper
- Defined in:
- lib/cockpit/helper.rb
Instance Method Summary collapse
-
#c(*args) ⇒ Object
always returns either an array or a string.
- #setting_options(attributes) ⇒ Object
- #setting_tag(tag) ⇒ Object
- #setting_value(value) ⇒ Object
- #settings_tag(key, &block) ⇒ Object
Instance Method Details
#c(*args) ⇒ Object
always returns either an array or a string
4 5 6 7 8 9 |
# File 'lib/cockpit/helper.rb', line 4 def c(*args) = args. result = args.collect {|i| Settings.get(i).value } result = result.pop if result.length == 1 result.blank? ? nil : result.to_s end |
#setting_options(attributes) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/cockpit/helper.rb', line 32 def (attributes) return {} unless (attributes.is_a?(Hash) && attributes[:options]) = case attributes[:options] when Proc attributes[:options].call else attributes[:options] end end |
#setting_tag(tag) ⇒ Object
11 12 13 |
# File 'lib/cockpit/helper.rb', line 11 def setting_tag(tag) end |
#setting_value(value) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/cockpit/helper.rb', line 21 def setting_value(value) result = case value when Proc value.call when Cockpit::TreeHash value else value end end |
#settings_tag(key, &block) ⇒ Object
15 16 17 18 19 |
# File 'lib/cockpit/helper.rb', line 15 def settings_tag(key, &block) Settings(key).each_setting do |key, attributes, value| end end |