Module: HasMedia
- Included in:
- ActiveRecord::Base
- Defined in:
- lib/has_media.rb,
lib/generators/has_media/install_generator.rb
Defined Under Namespace
Modules: ClassMethods, Generators
Constant Summary
collapse
- VERSION =
"0.0.1"
- @@medium_types =
{}
- @@store_dir =
'/tmp'
- @@directory_uri =
''
- @@errors_messages =
{:type_error => 'Wrong type'}
- @@encoded_extensions =
{
:image => 'png',
:audio => 'mp3',
:pdf => 'pdf',
:video => 'flv'
}
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.directory_path ⇒ Object
37
38
39
|
# File 'lib/has_media.rb', line 37
def self.directory_path
@@store_dir
end
|
.directory_path=(value) ⇒ Object
34
35
36
|
# File 'lib/has_media.rb', line 34
def self.directory_path=(value)
@@store_dir = value
end
|
.directory_uri ⇒ Object
43
44
45
|
# File 'lib/has_media.rb', line 43
def self.directory_uri
@@directory_uri
end
|
.directory_uri=(value) ⇒ Object
40
41
42
|
# File 'lib/has_media.rb', line 40
def self.directory_uri=(value)
@@directory_uri = value
end
|
.encoded_extensions ⇒ Object
31
32
33
|
# File 'lib/has_media.rb', line 31
def self.encoded_extensions
@@encoded_extensions
end
|
.encoded_extensions=(value) ⇒ Object
28
29
30
|
# File 'lib/has_media.rb', line 28
def self.encoded_extensions=(value)
@@encoded_extensions = value
end
|
.errors_messages ⇒ Object
46
47
48
|
# File 'lib/has_media.rb', line 46
def self.errors_messages
@@errors_messages
end
|
.errors_messages=(h) ⇒ Object
49
50
51
|
# File 'lib/has_media.rb', line 49
def self.errors_messages=(h)
@@errors_messages.merge!(h)
end
|
.included(mod) ⇒ Object
53
54
55
|
# File 'lib/has_media.rb', line 53
def self.included(mod)
mod.extend ClassMethods
end
|
.medium_types ⇒ Object
25
26
27
|
# File 'lib/has_media.rb', line 25
def self.medium_types
@@medium_types
end
|
.medium_types=(value) ⇒ Object
22
23
24
|
# File 'lib/has_media.rb', line 22
def self.medium_types=(value)
@@medium_types = value
end
|
Instance Method Details
160
161
162
163
164
|
# File 'lib/has_media.rb', line 160
def remove_old_media
(@old_media || []).each do |medium|
medium.destroy if medium
end
end
|