mdarby-acts_as_video_fu 1.2 → 1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/acts_as_video_fu.rb +14 -14
- data/lib/you_tube.rb +1 -1
- metadata +2 -2
data/lib/acts_as_video_fu.rb
CHANGED
@@ -2,18 +2,18 @@ module Mdarby
|
|
2
2
|
module Acts #:nodoc:
|
3
3
|
module Acts_as_video_fu #:nodoc:
|
4
4
|
|
5
|
-
VIMEO_RE = /^http:\/\/(www\.vimeo|vimeo)\.com\/[0-9]*$/
|
6
|
-
YOUTUBE_RE = /^http:\/\/(www\.youtube|youtube)\.com\/watch\?v=[^&]
|
5
|
+
VIMEO_RE = /^http:\/\/(www\.vimeo|vimeo)\.com\/[0-9]*$/
|
6
|
+
YOUTUBE_RE = /^http:\/\/(www\.youtube|youtube)\.com\/watch\?v=[^&]*(&.*){0,}$/
|
7
7
|
|
8
8
|
def self.included(base)
|
9
9
|
base.extend ClassMethods
|
10
10
|
end
|
11
11
|
|
12
|
-
module ClassMethods
|
13
|
-
def acts_as_video_fu
|
12
|
+
module ClassMethods
|
13
|
+
def acts_as_video_fu
|
14
14
|
include Mdarby::Acts::Acts_as_video_fu::InstanceMethods
|
15
|
-
extend Mdarby::Acts::Acts_as_video_fu::SingletonMethods
|
16
|
-
|
15
|
+
extend Mdarby::Acts::Acts_as_video_fu::SingletonMethods
|
16
|
+
|
17
17
|
before_save :validate
|
18
18
|
end
|
19
19
|
end
|
@@ -22,33 +22,33 @@ module Mdarby
|
|
22
22
|
end
|
23
23
|
|
24
24
|
module InstanceMethods
|
25
|
-
|
25
|
+
|
26
26
|
def type
|
27
27
|
return YouTube if youtube?
|
28
28
|
return Vimeo if vimeo?
|
29
29
|
return false
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
def youtube?
|
33
33
|
YOUTUBE_RE =~ video_url
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
def vimeo?
|
37
37
|
VIMEO_RE =~ video_url
|
38
38
|
end
|
39
|
-
|
40
|
-
|
39
|
+
|
40
|
+
|
41
41
|
private
|
42
|
-
|
42
|
+
|
43
43
|
def validate
|
44
44
|
raise "#{self.class.to_s}#video_url doesn't exist!" unless respond_to?(:video_url)
|
45
|
-
|
45
|
+
|
46
46
|
unless video_url.blank?
|
47
47
|
errors.add_to_base("Video URL has whitespace") if video_url.strip!
|
48
48
|
errors.add_to_base("Video URL is not recognized") unless type
|
49
49
|
end
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
data/lib/you_tube.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mdarby-acts_as_video_fu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: "1.
|
4
|
+
version: "1.3"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Darby
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-03-
|
12
|
+
date: 2009-03-15 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|