laserlemon-videoclip 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION.yml +1 -1
- data/lib/videoclip.rb +2 -10
- data/lib/videoclip/video.rb +6 -6
- data/videoclip.gemspec +1 -1
- metadata +1 -1
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('videoclip', '0.2.
|
5
|
+
Echoe.new('videoclip', '0.2.2') do |g|
|
6
6
|
g.description = %(Save videos from popular sites alongside your ActiveRecord models)
|
7
7
|
g.url = 'http://github.com/laserlemon/videoclip'
|
8
8
|
g.author = 'Steve Richert'
|
data/VERSION.yml
CHANGED
data/lib/videoclip.rb
CHANGED
@@ -16,18 +16,10 @@ module LaserLemon
|
|
16
16
|
composed_of name,
|
17
17
|
:class_name => 'LaserLemon::Videoclip::Video',
|
18
18
|
:mapping => %w(host key url).map{|x| %W(#{name}_#{x} #{x}) },
|
19
|
-
:constructor =>
|
20
|
-
:converter =>
|
19
|
+
:constructor => Proc.new{|h,k,u| LaserLemon::Videoclip::Video.build(h, k, u, options) },
|
20
|
+
:converter => Proc.new{|u| LaserLemon::Videoclip::Video.assign(u, options) },
|
21
21
|
:allow_nil => true
|
22
22
|
|
23
|
-
define_method "#{name}_with_options" do
|
24
|
-
v = send("#{name}_without_options")
|
25
|
-
v.options ||= self.class.videoclip_options[name.to_sym]
|
26
|
-
v
|
27
|
-
end
|
28
|
-
|
29
|
-
alias_method_chain name, :options
|
30
|
-
|
31
23
|
define_method "#{name}?" do
|
32
24
|
!! send(name)
|
33
25
|
end
|
data/lib/videoclip/video.rb
CHANGED
@@ -29,16 +29,16 @@ module LaserLemon
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
def build(host, key, url)
|
32
|
+
def build(host, key, url, options = {})
|
33
33
|
uri = parse_url(url)
|
34
34
|
klass = match(uri, host)
|
35
|
-
klass.new(key, url)
|
35
|
+
klass.new(key, url, options)
|
36
36
|
end
|
37
37
|
|
38
|
-
def assign(url)
|
38
|
+
def assign(url, options = {})
|
39
39
|
uri = parse_url(url)
|
40
40
|
klass = match(uri)
|
41
|
-
video = klass.new
|
41
|
+
video = klass.new(nil, nil, options)
|
42
42
|
video.assign(uri)
|
43
43
|
video
|
44
44
|
end
|
@@ -51,9 +51,9 @@ module LaserLemon
|
|
51
51
|
attr_reader :host, :key, :url
|
52
52
|
attr_accessor :options
|
53
53
|
|
54
|
-
def initialize(key = nil, url = nil)
|
54
|
+
def initialize(key = nil, url = nil, options = {})
|
55
55
|
@host = self.class.host
|
56
|
-
@key, @url = key, url
|
56
|
+
@key, @url, @options = key, url, options
|
57
57
|
end
|
58
58
|
|
59
59
|
protected
|
data/videoclip.gemspec
CHANGED