Class: Middleman::MetaPages::ConfigSetting
- Inherits:
-
Object
- Object
- Middleman::MetaPages::ConfigSetting
- Includes:
- Padrino::Helpers::OutputHelpers, Padrino::Helpers::TagHelpers
- Defined in:
- lib/middleman-core/meta_pages/config_setting.rb
Overview
View class for a config entry
Instance Method Summary collapse
-
#initialize(setting) ⇒ ConfigSetting
constructor
A new instance of ConfigSetting.
- #render ⇒ Object
Constructor Details
#initialize(setting) ⇒ ConfigSetting
Returns a new instance of ConfigSetting.
10 11 12 |
# File 'lib/middleman-core/meta_pages/config_setting.rb', line 10 def initialize(setting) @setting = setting end |
Instance Method Details
#render ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/middleman-core/meta_pages/config_setting.rb', line 14 def render content = '' key_classes = ['key'] key_classes << 'modified' if @setting.value_set? content << content_tag(:span, @setting.key.pretty_inspect.strip, class: key_classes.join(' ')) content << ' = ' content << content_tag(:span, @setting.value.pretty_inspect.strip, class: 'value') if @setting.default && @setting.value_set? && @setting.default != @setting.value content << content_tag(:span, class: 'default') do "(Default: #{@setting.default.inspect})" end end if @setting.description content << content_tag(:p, class: 'description') do @setting.description end end content end |