Module: Balloon::Uploader::ClassMethods

Defined in:
lib/balloon/uploader.rb

Instance Method Summary collapse

Instance Method Details

#uploader_dir(name) ⇒ Object



65
66
67
# File 'lib/balloon/uploader.rb', line 65

def uploader_dir(name)
  define_method "uploader_dir" do; name; end
end

#uploader_mimetype_black(list) ⇒ Object



100
101
102
103
# File 'lib/balloon/uploader.rb', line 100

def uploader_mimetype_black(list)
  raise "just choise one method" if respond_to?(:uploader_mime_type_black)
  define_method "uploader_mimetype_black" do; list; end
end

#uploader_mimetype_white(list) ⇒ Object



94
95
96
97
# File 'lib/balloon/uploader.rb', line 94

def uploader_mimetype_white(list)
  raise "just choise one method" if respond_to?(:uploader_mime_type_black)
  define_method "uploader_mimetype_white" do; list; end
end

#uploader_name_format(info) ⇒ Object



83
84
85
86
87
88
# File 'lib/balloon/uploader.rb', line 83

def uploader_name_format(info)
  define_method "uploader_name_format" do
    name = info[:name].is_a?(Proc) ? info[:name].call(self) : info[:name].to_s
    { name: name, format: info[:format] }
  end
end

#uploader_size(options) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/balloon/uploader.rb', line 69

def uploader_size(options)
  list = {}

  if options.is_a?(Hash)
    options.each do |key, value|
      list[key] = parsing_size_string(value)
    end
  else
    list[:orignal] = parsing_size_string options
  end

  define_method "uploader_size" do; list; end
end

#uploader_type_format(ext) ⇒ Object



90
91
92
# File 'lib/balloon/uploader.rb', line 90

def uploader_type_format(ext)
  define_method "uploader_type_format" do; ext; end
end