Class: ActiveAdmin::StringSymbolOrProcSetting

Inherits:
DynamicSetting show all
Defined in:
lib/active_admin/dynamic_setting.rb

Overview

Many configuration options (Ex: site_title, title_image) could either be static (String), methods (Symbol) or procs (Proc). This wrapper takes care of returning the content when String or using instance_eval when Symbol or Proc.

Instance Method Summary collapse

Methods inherited from DynamicSetting

build, #initialize, klass

Constructor Details

This class inherits a constructor from ActiveAdmin::DynamicSetting

Instance Method Details

#value(context = self) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/active_admin/dynamic_setting.rb', line 29

def value(context = self)
  case @setting
  when Symbol, Proc
    context.instance_eval(&@setting)
  else
    @setting
  end
end