Module: RailsAdminSettings::Processing
- Included in:
- Setting
- Defined in:
- lib/rails_admin_settings/processing.rb
Instance Method Summary collapse
- #blank? ⇒ Boolean
- #html_type? ⇒ Boolean
- #text_type? ⇒ Boolean
- #to_s ⇒ Object
- #upload_type? ⇒ Boolean
- #value ⇒ Object
Instance Method Details
#blank? ⇒ Boolean
35 36 37 38 39 40 41 42 43 |
# File 'lib/rails_admin_settings/processing.rb', line 35 def blank? if file_type? file.url.nil? elsif raw.blank? || disabled? true else false end end |
#html_type? ⇒ Boolean
17 18 19 |
# File 'lib/rails_admin_settings/processing.rb', line 17 def html_type? ['html', 'sanitized'].include? type end |
#text_type? ⇒ Boolean
9 10 11 |
# File 'lib/rails_admin_settings/processing.rb', line 9 def text_type? (RailsAdminSettings.types - ['phone', 'integer', 'yaml']).include? type end |
#to_s ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/rails_admin_settings/processing.rb', line 45 def to_s if yaml_type? || phone_type? || integer_type? raw else value end end |
#upload_type? ⇒ Boolean
13 14 15 |
# File 'lib/rails_admin_settings/processing.rb', line 13 def upload_type? ['file', 'image'].include? type end |
#value ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rails_admin_settings/processing.rb', line 21 def value if upload_type? if file? file.url else nil end elsif raw.blank? || disabled? default_value else processed_value end end |