youtube_embed 0.0.3 → 0.0.4

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.
@@ -1,3 +1,3 @@
1
1
  module YoutubeEmbed
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/youtube_embed.rb CHANGED
@@ -21,11 +21,11 @@ module YoutubeEmbed
21
21
 
22
22
  def self.youtube_embed(data, options = {:with_description => true, :height => 200, :width => 300})
23
23
  if data.match(/https?:\/\/?(?:www\.)?youtu(?:\.be|be\.com)/)
24
- data = data.gsub(/<a?[^<]+ href="(?:https?:\/\/)?(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=)?\w{10,11}"?[^<]+>([^<]+)<\/a>/i, '\1')
24
+ data = data.gsub(/<a?[^<]+ href="(?:https?:\/\/)?(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=)?[a-zA-Z0-9-]{10,11}"?[^<]+>([^<]+)<\/a>/i, '\1')
25
25
  if options[:with_description]
26
- data = data.gsub(/((?:https?:\/\/)?(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=)?\w{10,11})/i, thumbnail_and_description("#{$1}", options[:width], options[:height]))
26
+ data = data.gsub(/((?:https?:\/\/)?(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=)?[a-zA-Z0-9-]{10,11})/i, thumbnail_and_description("#{$1}", options[:width], options[:height]))
27
27
  else
28
- data = data.gsub(/((?:https?:\/\/)?(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=)?\w{10,11})/i, simple("#{$1}", options[:width], options[:height]))
28
+ data = data.gsub(/((?:https?:\/\/)?(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=)?[a-zA-Z0-9-]{10,11})/i, simple("#{$1}", options[:width], options[:height]))
29
29
  end
30
30
  end
31
31
  return data
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: youtube_embed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-29 00:00:00.000000000 Z
12
+ date: 2013-05-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty