videawesome 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/videawesome.rb +19 -19
  2. metadata +4 -4
data/lib/videawesome.rb CHANGED
@@ -1,27 +1,27 @@
1
1
  module Videawesome
2
2
  class Convertor
3
3
  def self.youtube_video(url, text, height, width)
4
- ident_regexp = /[a-zA-Z0-9]{11}/
5
- url_ident =url.scan(ident_regexp).to_s
6
- altered_text = text.gsub(url,"<iframe title='YouTube video player' class='youtube-player' type='text/html' width='#{width}' height='#{height}' src='http://www.youtube.com/v/#{url_ident}' frameborder='0'></iframe><br /><small> dont have flash player installed? <a href=\"http://www.youtube.com/v/#{url_ident}\" target=\"_blank\">click here</a></small>")
7
- end
4
+ ident_regexp = /[a-zA-Z0-9]{11}/
5
+ url_ident =url.scan(ident_regexp).to_s
6
+ altered_text = text.gsub(url,"<iframe title='YouTube video player' class='youtube-player' type='text/html' width='#{width}' height='#{height}' src='http://www.youtube.com/v/#{url_ident}' frameborder='0'></iframe><br /><small> dont have flash player installed? <a href=\"http://www.youtube.com/v/#{url_ident}\" target=\"_blank\">click here</a></small>")
7
+ end
8
8
 
9
- def self.vimeo_video(url, text, height, width)
10
- ident_regexp = /\/[0-9]{3,}/
11
- url_ident = url.scan(ident_regexp).to_s
12
- altered_text = text.gsub(url,"<iframe title='Vimeo Video Player' src='http://player.vimeo.com/video#{url_ident}' width='#{width}' height='#{height}' frameborder='0'></iframe><br /> <small>dont have flash player installed? <a href=\"http://player.vimeo.com/video#{url_ident}\" target=\"_blank\">click here</a></small>")
13
- end
9
+ def self.vimeo_video(url, text, height, width)
10
+ ident_regexp = /\/[0-9]{3,}/
11
+ url_ident = url.scan(ident_regexp).to_s
12
+ altered_text = text.gsub(url,"<iframe title='Vimeo Video Player' src='http://player.vimeo.com/video#{url_ident}' width='#{width}' height='#{height}' frameborder='0'></iframe><br /> <small>dont have flash player installed? <a href=\"http://player.vimeo.com/video#{url_ident}\" target=\"_blank\">click here</a></small>")
13
+ end
14
14
 
15
- def self.parse_video(text, height, width)
16
- youtube_regexp = /(ht)tp\:\/\/[www.youtube||vimeo]+\.(com)/
17
- url = text.split.grep(youtube_regexp).to_s
18
-
19
- if url != "" && url.match("youtube.com")
20
- text = youtube_video(url, text, height, width)
21
- elsif url != "" && url.match("vimeo.com")
22
- text = vimeo_video(url, text, height, width)
15
+ def self.parse_video(text, height, width)
16
+ youtube_regexp = /(ht)tp\:\/\/[www.youtube||vimeo||youtu]+\.[com||be]/
17
+ url = text.split.grep(youtube_regexp).to_s
18
+
19
+ if url != "" && url.match("youtube.com") || url.match("http://youtu.be")
20
+ text = youtube_video(url, text, height, width)
21
+ elsif url != "" && url.match("vimeo.com")
22
+ text = vimeo_video(url, text, height, width)
23
+ end
24
+ return text
23
25
  end
24
- return text
25
- end
26
26
  end
27
27
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: videawesome
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Lee
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-25 00:00:00 +00:00
18
+ date: 2011-05-09 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies: []
21
21