Class: Tomify::SettingUploader

Inherits:
Object
  • Object
show all
Defined in:
app/uploaders/tomify/setting_uploader.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.heightObject



8
9
10
11
12
# File 'app/uploaders/tomify/setting_uploader.rb', line 8

def self.height
  Proc.new do |uploader|
    uploader.setting["height"] || 1000000000
  end
end

.widthObject



2
3
4
5
6
# File 'app/uploaders/tomify/setting_uploader.rb', line 2

def self.width
  Proc.new do |uploader|
    uploader.setting["width"] || 1000000000
  end
end

Instance Method Details

#settingObject



23
24
25
# File 'app/uploaders/tomify/setting_uploader.rb', line 23

def setting
  Tomify.setting(setting_key) || { "width" => width, "height" => height }
end

#setting_keyObject



16
17
18
19
20
21
# File 'app/uploaders/tomify/setting_uploader.rb', line 16

def setting_key
  [
    model.class.name.split("::").last.underscore,
    mounted_as, "dimensions"
  ].join("_")
end