acts_as_keyed 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/lib/acts_as_keyed.rb CHANGED
@@ -1,18 +1,19 @@
1
1
  module ActsAsKeyed
2
2
  def self.included(base)
3
- base.extend ClassMethods
3
+ base.extend ClassMethods
4
4
  end
5
+
5
6
  module ClassMethods
6
7
  def acts_as_keyed(options={})
7
8
  class_inheritable_accessor :options
8
9
  options[:size] ||= 10
9
- options[:chars] ||= ('a'..'z').to_a - ['a','e','i','o','u'] + (1..9).to_a
10
+ options[:chars] ||= ('a'..'z').to_a + ('A'..'Z').to_a + (1..9).to_a - ['l','I','O']
10
11
  self.options = options
11
12
 
12
13
  raise ArgumentError, "#{self.name} is missing key column" if columns_hash['key'].nil?
13
14
 
14
15
  before_validation_on_create :create_key
15
-
16
+
16
17
  attr_protected :key
17
18
 
18
19
  class << self
@@ -24,10 +25,11 @@ module ActsAsKeyed
24
25
  end
25
26
  end
26
27
  end
27
-
28
+
28
29
  include InstanceMethods
29
30
  end
30
31
  end
32
+
31
33
  module InstanceMethods
32
34
 
33
35
  def to_param
@@ -51,3 +53,5 @@ module ActsAsKeyed
51
53
  end
52
54
  end
53
55
  end
56
+
57
+ ActiveRecord::Base.send :include, ActsAsKeyed
@@ -1,3 +1,3 @@
1
1
  module ActsAsKeyed
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_keyed
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jeremy Hubert
@@ -33,10 +33,8 @@ files:
33
33
  - Gemfile
34
34
  - Rakefile
35
35
  - acts_as_keyed.gemspec
36
- - init.rb
37
36
  - lib/acts_as_keyed.rb
38
37
  - lib/acts_as_keyed/version.rb
39
- - rails/init.rb
40
38
  has_rdoc: true
41
39
  homepage: http://github.com/jhubert/acts_as_keyed
42
40
  licenses: []
data/init.rb DELETED
@@ -1 +0,0 @@
1
- require File.dirname(__FILE__) + "/rails/init"
data/rails/init.rb DELETED
@@ -1,2 +0,0 @@
1
- require 'acts_as_keyed'
2
- ActiveRecord::Base.send(:include, ActsAsKeyed)