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 CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('videoclip', '0.2.1') do |g|
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
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 2
4
- :patch: 1
4
+ :patch: 2
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 => :build,
20
- :converter => :assign,
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
@@ -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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{videoclip}
5
- s.version = "0.2.1"
5
+ s.version = "0.2.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Steve Richert"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: laserlemon-videoclip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Richert