Class: RailsAdminSettings::Setting
Instance Method Summary
collapse
included
Methods included from Validation
included
Methods included from Uploads
included
Methods included from Processing
#blank?, #html_type?, #text_type?, #to_s, #upload_type?, #value
Instance Method Details
#as_yaml(options = {}) ⇒ Object
53
54
55
56
57
58
59
60
61
62
|
# File 'app/models/rails_admin_settings/setting.rb', line 53
def as_yaml(options = {})
v = {type: type, enabled: enabled, label: label}
if upload_type?
v[:value] = to_path
else
v[:value] = raw
end
v.stringify_keys!
v
end
|
#disabled? ⇒ Boolean
33
34
35
|
# File 'app/models/rails_admin_settings/setting.rb', line 33
def disabled?
!enabled
end
|
#enabled? ⇒ Boolean
37
38
39
|
# File 'app/models/rails_admin_settings/setting.rb', line 37
def enabled?
enabled
end
|
#name ⇒ Object
41
42
43
|
# File 'app/models/rails_admin_settings/setting.rb', line 41
def name
label.blank? ? key : label
end
|
#to_path ⇒ Object
45
46
47
48
49
50
51
|
# File 'app/models/rails_admin_settings/setting.rb', line 45
def to_path
if value.nil?
nil
else
URI.parse(value).path
end
end
|