Class: Middleman::MetaPages::ConfigSetting

Inherits:
Object
  • Object
show all
Includes:
Padrino::Helpers::OutputHelpers, Padrino::Helpers::TagHelpers
Defined in:
middleman-core/lib/middleman-core/meta_pages/config_setting.rb

Overview

View class for a config entry

Instance Method Summary collapse

Constructor Details

#initialize(setting) ⇒ ConfigSetting

Returns a new instance of ConfigSetting



10
11
12
# File 'middleman-core/lib/middleman-core/meta_pages/config_setting.rb', line 10

def initialize(setting)
  @setting = setting
end

Instance Method Details

#renderObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'middleman-core/lib/middleman-core/meta_pages/config_setting.rb', line 14

def render
  content = ''
  key_classes = ['key']
  key_classes << 'modified' if @setting.value_set?
  content << (:span, @setting.key.pretty_inspect.strip, class: key_classes.join(' '))
  content << ' = '
  content << (:span, @setting.value.pretty_inspect.strip, class: 'value')
  if @setting.default && @setting.value_set? && @setting.default != @setting.value
    content << (:span, class: 'default') do
      "(Default: #{@setting.default.inspect})"
    end
  end

  if @setting.description
    content << (:p, class: 'description') do
      @setting.description
    end
  end

  content
end