have-code 0.1.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ begin
5
5
  require 'jeweler'
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = "have-code"
8
- gem.summary = %Q{TODO}
8
+ gem.summary = "Add clever little base36 codes for your DataMapper and ActiveRecord objects."
9
9
  gem.email = "bkerley@brycekerley.net"
10
10
  gem.homepage = "http://github.com/bkerley/have-code"
11
11
  gem.authors = ["Bryce Kerley"]
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 3
3
2
  :major: 0
4
- :minor: 1
3
+ :minor: 2
4
+ :patch: 0
data/have-code.gemspec CHANGED
@@ -1,12 +1,15 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
1
4
  # -*- encoding: utf-8 -*-
2
5
 
3
6
  Gem::Specification.new do |s|
4
7
  s.name = %q{have-code}
5
- s.version = "0.1.3"
8
+ s.version = "0.2.0"
6
9
 
7
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
11
  s.authors = ["Bryce Kerley"]
9
- s.date = %q{2009-06-10}
12
+ s.date = %q{2009-10-15}
10
13
  s.email = %q{bkerley@brycekerley.net}
11
14
  s.extra_rdoc_files = [
12
15
  "LICENSE",
@@ -22,19 +25,19 @@ Gem::Specification.new do |s|
22
25
  "have-code.gemspec",
23
26
  "lib/have-code.rb",
24
27
  "lib/have-code/ar_code.rb",
28
+ "lib/have-code/common_code.rb",
25
29
  "lib/have-code/dm_code.rb",
26
30
  "test/active_record_helper.rb",
27
31
  "test/data_mapper_helper.rb",
28
32
  "test/have_code_test.rb",
29
33
  "test/test_helper.rb"
30
34
  ]
31
- s.has_rdoc = true
32
35
  s.homepage = %q{http://github.com/bkerley/have-code}
33
36
  s.rdoc_options = ["--charset=UTF-8"]
34
37
  s.require_paths = ["lib"]
35
38
  s.rubyforge_project = %q{have-code}
36
- s.rubygems_version = %q{1.3.1}
37
- s.summary = %q{TODO}
39
+ s.rubygems_version = %q{1.3.5}
40
+ s.summary = %q{Add clever little base36 codes for your DataMapper and ActiveRecord objects.}
38
41
  s.test_files = [
39
42
  "test/active_record_helper.rb",
40
43
  "test/data_mapper_helper.rb",
@@ -44,7 +47,7 @@ Gem::Specification.new do |s|
44
47
 
45
48
  if s.respond_to? :specification_version then
46
49
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
47
- s.specification_version = 2
50
+ s.specification_version = 3
48
51
 
49
52
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
50
53
  s.add_runtime_dependency(%q<bkerley-affine>, [">= 0"])
data/lib/have-code.rb CHANGED
@@ -1,11 +1,17 @@
1
1
  require 'affine'
2
+ require File.join(File.dirname(__FILE__), 'have-code', 'common_code')
2
3
  require File.join(File.dirname(__FILE__), 'have-code', 'ar_code')
3
4
  require File.join(File.dirname(__FILE__), 'have-code', 'dm_code')
5
+
4
6
  module HaveCode
7
+
8
+ # mix the HaveCode methods into ActiveRecord::Base objects
5
9
  def self.enable_activerecord
6
10
  return if ActiveRecord::Base.respond_to? :have_code
7
11
  ActiveRecord::Base.send :include, ARCode
8
12
  end
13
+
14
+ # mix the HaveCode methods into DataMapper::Resource objects
9
15
  def self.enable_datamapper
10
16
  return if DataMapper::Resource.respond_to? :have_code
11
17
  DataMapper::Resource.send :include, DMCode
@@ -9,7 +9,7 @@ module HaveCode
9
9
  write_inheritable_attribute :have_code_cipher, Affine::Cipher.new(mod, a, b)
10
10
 
11
11
  extend OptionalClassMethods
12
- include InstanceMethods
12
+ include HaveCode::CommonCode::InstanceMethods
13
13
  end
14
14
  end
15
15
 
@@ -25,15 +25,5 @@ module HaveCode
25
25
  nil
26
26
  end
27
27
  end
28
-
29
- module InstanceMethods
30
- def have_code_cipher
31
- self.class.read_inheritable_attribute :have_code_cipher
32
- end
33
-
34
- def code
35
- have_code_cipher.encipher(id).to_s(36)
36
- end
37
- end
38
28
  end
39
29
  end
@@ -0,0 +1,13 @@
1
+ module HaveCode
2
+ module CommonCode
3
+ module InstanceMethods
4
+ def have_code_cipher
5
+ self.class.read_inheritable_attribute :have_code_cipher
6
+ end
7
+
8
+ def code
9
+ have_code_cipher.encipher(id).to_s(36)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -9,7 +9,7 @@ module HaveCode
9
9
  write_inheritable_attribute :have_code_cipher, Affine::Cipher.new(mod, a, b)
10
10
 
11
11
  extend OptionalClassMethods
12
- include InstanceMethods
12
+ include HaveCode::CommonCode::InstanceMethods
13
13
  end
14
14
  end
15
15
 
@@ -25,15 +25,5 @@ module HaveCode
25
25
  nil
26
26
  end
27
27
  end
28
-
29
- module InstanceMethods
30
- def have_code_cipher
31
- self.class.read_inheritable_attribute :have_code_cipher
32
- end
33
-
34
- def code
35
- have_code_cipher.encipher(id).to_s(36)
36
- end
37
- end
38
28
  end
39
29
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: have-code
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryce Kerley
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-10 00:00:00 -04:00
12
+ date: 2009-10-15 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -41,6 +41,7 @@ files:
41
41
  - have-code.gemspec
42
42
  - lib/have-code.rb
43
43
  - lib/have-code/ar_code.rb
44
+ - lib/have-code/common_code.rb
44
45
  - lib/have-code/dm_code.rb
45
46
  - test/active_record_helper.rb
46
47
  - test/data_mapper_helper.rb
@@ -48,6 +49,8 @@ files:
48
49
  - test/test_helper.rb
49
50
  has_rdoc: true
50
51
  homepage: http://github.com/bkerley/have-code
52
+ licenses: []
53
+
51
54
  post_install_message:
52
55
  rdoc_options:
53
56
  - --charset=UTF-8
@@ -68,10 +71,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
71
  requirements: []
69
72
 
70
73
  rubyforge_project: have-code
71
- rubygems_version: 1.3.1
74
+ rubygems_version: 1.3.5
72
75
  signing_key:
73
- specification_version: 2
74
- summary: TODO
76
+ specification_version: 3
77
+ summary: Add clever little base36 codes for your DataMapper and ActiveRecord objects.
75
78
  test_files:
76
79
  - test/active_record_helper.rb
77
80
  - test/data_mapper_helper.rb