ploymorphic_wuid 0.2.1 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -10,8 +10,6 @@ begin
10
10
  gem.description = %Q{ This is a gem to generate an unique id in your application world.}
11
11
  gem.email = "tim.rubist@gmail.com"
12
12
  gem.homepage = "http://github.com/tteng/ploymorphic_wuid"
13
- gem.add_development_dependency "acts_as_tree", ">= 0.1.1"
14
- gem.add_runtime_dependency "acts_as_tree", ">= 0.1.1"
15
13
  gem.authors = ["tim.teng"]
16
14
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
15
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.4.1
@@ -7,46 +7,25 @@ module PloymorphicModule
7
7
  module ClassMethods
8
8
 
9
9
  def acts_as_wuid options={}
10
- #TODO auto set wuid with conditional hook
11
10
  has_one :wuid, :as => :wuidable, :dependent => :destroy
12
- if options[:acts_as_tree]
13
- Wuid.class_eval do
14
- acts_as_tree :foreign_key => "reference_to"
15
- end
16
- include PloymorphicModule::AdvancedInstanceMethods
17
- else
18
- include PloymorphicModule::InstanceMethods
19
- end
11
+ include PloymorphicModule::InstanceMethods
20
12
  end
21
13
 
22
14
  end
23
15
 
24
16
  module InstanceMethods
25
17
 
26
- def after_create
27
- super
28
- create_wuid
29
- end
30
-
31
- def create_wuid
32
- wuid.create
33
- end
34
-
35
18
  def wid
36
19
  self.wuid.id
37
20
  end
38
21
 
39
- end
40
-
41
- module AdvancedInstanceMethods
42
-
43
- def wid
44
- (self.respond_to?(:reference_to) && self.parent) ? self.parent.wid : self.wuid.id
22
+ def after_create
23
+ super
24
+ create_wuid
45
25
  end
46
26
 
47
- def wid= id=nil
48
- w = self.wuild.build :reference_to => id
49
- w.save
27
+ def create_wuid
28
+ wuid.create
50
29
  end
51
30
 
52
31
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ploymorphic_wuid}
8
- s.version = "0.2.1"
8
+ s.version = "0.4.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["tim.teng"]
@@ -44,15 +44,9 @@ Gem::Specification.new do |s|
44
44
  s.specification_version = 3
45
45
 
46
46
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
47
- s.add_development_dependency(%q<acts_as_tree>, [">= 0.1.1"])
48
- s.add_runtime_dependency(%q<acts_as_tree>, [">= 0.1.1"])
49
47
  else
50
- s.add_dependency(%q<acts_as_tree>, [">= 0.1.1"])
51
- s.add_dependency(%q<acts_as_tree>, [">= 0.1.1"])
52
48
  end
53
49
  else
54
- s.add_dependency(%q<acts_as_tree>, [">= 0.1.1"])
55
- s.add_dependency(%q<acts_as_tree>, [">= 0.1.1"])
56
50
  end
57
51
  end
58
52
 
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
7
+ - 4
8
8
  - 1
9
- version: 0.2.1
9
+ version: 0.4.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - tim.teng
@@ -16,35 +16,8 @@ cert_chain: []
16
16
 
17
17
  date: 2010-03-31 00:00:00 +08:00
18
18
  default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: acts_as_tree
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- requirements:
25
- - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- - 1
30
- - 1
31
- version: 0.1.1
32
- type: :development
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: acts_as_tree
36
- prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 0
43
- - 1
44
- - 1
45
- version: 0.1.1
46
- type: :runtime
47
- version_requirements: *id002
19
+ dependencies: []
20
+
48
21
  description: " This is a gem to generate an unique id in your application world."
49
22
  email: tim.rubist@gmail.com
50
23
  executables: []