enum_type 2.1.2 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a3e4e56b190e7bafd870a8d85d36f2d510db511
4
- data.tar.gz: 7b6ed07e741a01450e0546ed39dbcf9ec76295e9
3
+ metadata.gz: 94e443bdb2349b66f3c88f2cf08420a46cec5553
4
+ data.tar.gz: 0b2a7406a96f7e7b37c5fff4bf66d15f59f5bb28
5
5
  SHA512:
6
- metadata.gz: 98cd180bedacbf7233eb4bc7e87eb1211dc00407cc0e6614602e1b3c9094e49eb2b684a24c17ab38ac8483c003f6fbcae140046fd4857bf9d9c17b2f1452a20d
7
- data.tar.gz: 1c8d026cbd98ef6d02406c2c868cfb06b8da813fbd41d4448353a8c5194acac59d0af4ffe0285d1339b8f5784944064fdb3aa8b79d2bd8368fa87d656727ea5e
6
+ metadata.gz: 77cb03044e0796c8f02917eecc3b84fbde000c2c5dadc74b2e11f22520986257d05ed5a7cc992486bd58d23f40c82261a127c2266efb92457e6cdc16880679b4
7
+ data.tar.gz: b6c47f3f60dd12ec1a70418ae14067df7126bd5e2cd1af707f93493461c8f606b9eaa6f10ca1768730939164e6d6e91d0c0ddd73418ca05190dbc0dfe518138b
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.0.0
1
+ ruby-2.0.0
data/Gemfile CHANGED
@@ -8,11 +8,11 @@ group :development do
8
8
  # DEVELOPMENT
9
9
  gem 'jeweler'
10
10
  gem 'yard'
11
- gem 'RedCloth', require: 'redcloth'
11
+ gem 'redcarpet', require: nil
12
12
 
13
13
  # TEST
14
14
  gem 'rspec'
15
15
  gem 'factory_girl'
16
- platform(:mri) { gem 'pg' }
17
- platform(:jruby) { gem 'activerecord-jdbcpostgresql-adapter' }
16
+ gem 'pg', platform: :mri
17
+ gem 'activerecord-jdbcpostgresql-adapter', platform: :jruby
18
18
  end
data/Gemfile.lock CHANGED
@@ -1,23 +1,21 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- RedCloth (4.2.9)
5
- RedCloth (4.2.9-java)
6
- activemodel (4.0.1)
7
- activesupport (= 4.0.1)
4
+ activemodel (4.0.2)
5
+ activesupport (= 4.0.2)
8
6
  builder (~> 3.1.0)
9
- activerecord (4.0.1)
10
- activemodel (= 4.0.1)
7
+ activerecord (4.0.2)
8
+ activemodel (= 4.0.2)
11
9
  activerecord-deprecated_finders (~> 1.0.2)
12
- activesupport (= 4.0.1)
10
+ activesupport (= 4.0.2)
13
11
  arel (~> 4.0.0)
14
12
  activerecord-deprecated_finders (1.0.3)
15
- activerecord-jdbc-adapter (1.3.2)
13
+ activerecord-jdbc-adapter (1.3.4)
16
14
  activerecord (>= 2.2)
17
- activerecord-jdbcpostgresql-adapter (1.3.2)
18
- activerecord-jdbc-adapter (~> 1.3.2)
15
+ activerecord-jdbcpostgresql-adapter (1.3.4)
16
+ activerecord-jdbc-adapter (~> 1.3.4)
19
17
  jdbc-postgres (>= 9.1)
20
- activesupport (4.0.1)
18
+ activesupport (4.0.2)
21
19
  i18n (~> 0.6, >= 0.6.4)
22
20
  minitest (~> 4.2)
23
21
  multi_json (~> 1.3)
@@ -44,8 +42,8 @@ GEM
44
42
  hashie (2.0.5)
45
43
  highline (1.6.20)
46
44
  httpauth (0.2.0)
47
- i18n (0.6.5)
48
- jdbc-postgres (9.2.1004)
45
+ i18n (0.6.9)
46
+ jdbc-postgres (9.3.1100)
49
47
  jeweler (1.8.8)
50
48
  builder
51
49
  bundler (~> 1.0)
@@ -72,11 +70,12 @@ GEM
72
70
  multi_json (~> 1.0)
73
71
  multi_xml (~> 0.5)
74
72
  rack (~> 1.2)
75
- pg (0.17.0)
73
+ pg (0.17.1)
76
74
  rack (1.5.2)
77
- rake (10.1.0)
78
- rdoc (4.0.1)
75
+ rake (10.1.1)
76
+ rdoc (4.1.0)
79
77
  json (~> 1.4)
78
+ redcarpet (3.0.0)
80
79
  rspec (2.14.1)
81
80
  rspec-core (~> 2.14.0)
82
81
  rspec-expectations (~> 2.14.0)
@@ -97,12 +96,12 @@ PLATFORMS
97
96
  ruby
98
97
 
99
98
  DEPENDENCIES
100
- RedCloth
101
99
  activerecord (>= 4.0)
102
100
  activerecord-jdbcpostgresql-adapter
103
101
  activesupport (>= 4.0)
104
102
  factory_girl
105
103
  jeweler
106
104
  pg
105
+ redcarpet
107
106
  rspec
108
107
  yard
data/README.md ADDED
@@ -0,0 +1,53 @@
1
+ enum_type
2
+ =========
3
+
4
+ **Enumerated Types in ActiveRecord**
5
+
6
+ | | |
7
+ |:------------|:--------------------------------|
8
+ | **Author** | Tim Morgan |
9
+ | **Version** | 2.1.2 (Nov 10, 2013) |
10
+ | **License** | Released under the MIT license. |
11
+
12
+ About
13
+ -----
14
+
15
+ `enum_type` allows you to effectively use the PostgreSQL `ENUM` data type in
16
+ your ActiveRecord models. It's a really simple gem that just adds a convenience
17
+ method to take care of the usual "witch chant" that accompanies building an
18
+ enumerated type in Rails.
19
+
20
+ Installation
21
+ ------------
22
+
23
+ **Important Note:** This gem requires Ruby 1.9+. Ruby 1.8 is not supported, and
24
+ will never be.
25
+
26
+ First, add the `enum_type` gem to your `Gemfile`:
27
+
28
+ ```` ruby
29
+ gem 'enum_type'
30
+ ````
31
+
32
+ Then, extend your model with the `EnumType` module:
33
+
34
+ ```` ruby
35
+ class MyModel < ActiveRecord::Base
36
+ extend EnumType
37
+ end
38
+ ````
39
+
40
+ Usage
41
+ -----
42
+
43
+ In your model, call the `enum_type` method, providing one or more enumerated
44
+ fields, and any additional options:
45
+
46
+ ```` ruby
47
+ class MyModel < ActiveRecord::Base
48
+ extend EnumType
49
+ enum_type :status, %w( active pending admin superadmin banned )
50
+ end
51
+ ````
52
+
53
+ See the {EnumType#enum_type} method documentation for more information.
data/Rakefile CHANGED
@@ -11,12 +11,12 @@ require 'rake'
11
11
 
12
12
  require 'jeweler'
13
13
  Jeweler::Tasks.new do |gem|
14
- gem.name = "enum_type"
15
- gem.summary = %Q{PostgreSQL enumerated types in ActiveRecord}
16
- gem.description = %Q{Allows ActiveRecord to better use PostgreSQL's ENUM types.}
17
- gem.email = "git@timothymorgan.info"
18
- gem.homepage = "http://github.com/riscfuture/enum_type"
19
- gem.authors = [ "Tim Morgan" ]
14
+ gem.name = "enum_type"
15
+ gem.summary = %Q{PostgreSQL enumerated types in ActiveRecord}
16
+ gem.description = %Q{Allows ActiveRecord to better use PostgreSQL's ENUM types.}
17
+ gem.email = 'git@timothymorgan.info'
18
+ gem.homepage = 'http://github.com/riscfuture/enum_type'
19
+ gem.authors = ["Tim Morgan"]
20
20
  gem.required_ruby_version = '>= 1.9'
21
21
  gem.add_dependency "activerecord", ">= 0"
22
22
  end
@@ -26,14 +26,23 @@ require 'rspec/core/rake_task'
26
26
  RSpec::Core::RakeTask.new
27
27
 
28
28
  require 'yard'
29
+
30
+ # bring sexy back (sexy == tables)
31
+ module YARD::Templates::Helpers::HtmlHelper
32
+ def html_markup_markdown(text)
33
+ markup_class(:markdown).new(text, :gh_blockcode, :fenced_code, :autolink, :tables, :no_intraemphasis).to_html
34
+ end
35
+ end
36
+
29
37
  YARD::Rake::YardocTask.new('doc') do |doc|
30
- doc.options << "-m" << "textile"
31
- doc.options << "--protected"
32
- doc.options << "-r" << "README.textile"
33
- doc.options << "-o" << "doc"
34
- doc.options << "--title" << "enum_type Documentation"
35
-
36
- doc.files = [ 'lib/**/*', 'README.textile' ]
38
+ doc.options << '-m' << 'markdown'
39
+ doc.options << '-M' << 'redcarpet'
40
+ doc.options << '--protected' << '--no-private'
41
+ doc.options << '-r' << 'README.md'
42
+ doc.options << '-o' << 'doc'
43
+ doc.options << '--title' << 'enum_type Documentation'
44
+
45
+ doc.files = %w(lib/**/* README.md)
37
46
  end
38
47
 
39
48
  task(default: :spec)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.2
1
+ 2.2.0
data/enum_type.gemspec CHANGED
@@ -2,20 +2,21 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: enum_type 2.1.2 ruby lib
5
+ # stub: enum_type 2.2.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "enum_type"
9
- s.version = "2.1.2"
9
+ s.version = "2.2.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
12
13
  s.authors = ["Tim Morgan"]
13
- s.date = "2013-11-11"
14
+ s.date = "2013-12-26"
14
15
  s.description = "Allows ActiveRecord to better use PostgreSQL's ENUM types."
15
16
  s.email = "git@timothymorgan.info"
16
17
  s.extra_rdoc_files = [
17
18
  "LICENSE",
18
- "README.textile"
19
+ "README.md"
19
20
  ]
20
21
  s.files = [
21
22
  ".document",
@@ -25,7 +26,7 @@ Gem::Specification.new do |s|
25
26
  "Gemfile",
26
27
  "Gemfile.lock",
27
28
  "LICENSE",
28
- "README.textile",
29
+ "README.md",
29
30
  "Rakefile",
30
31
  "VERSION",
31
32
  "enum_type.gemspec",
@@ -36,9 +37,8 @@ Gem::Specification.new do |s|
36
37
  "spec/spec_helper.rb"
37
38
  ]
38
39
  s.homepage = "http://github.com/riscfuture/enum_type"
39
- s.require_paths = ["lib"]
40
40
  s.required_ruby_version = Gem::Requirement.new(">= 1.9")
41
- s.rubygems_version = "2.1.10"
41
+ s.rubygems_version = "2.2.0"
42
42
  s.summary = "PostgreSQL enumerated types in ActiveRecord"
43
43
 
44
44
  if s.respond_to? :specification_version then
@@ -47,37 +47,34 @@ Gem::Specification.new do |s|
47
47
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
48
48
  s.add_runtime_dependency(%q<activerecord>, [">= 4.0"])
49
49
  s.add_runtime_dependency(%q<activesupport>, [">= 4.0"])
50
- s.add_development_dependency(%q<jeweler>, [">= 0"])
51
- s.add_development_dependency(%q<yard>, [">= 0"])
52
- s.add_development_dependency(%q<RedCloth>, [">= 0"])
53
- s.add_development_dependency(%q<rspec>, [">= 0"])
54
- s.add_development_dependency(%q<factory_girl>, [">= 0"])
55
- s.add_development_dependency(%q<pg>, [">= 0"])
56
- s.add_development_dependency(%q<activerecord-jdbcpostgresql-adapter>, [">= 0"])
57
- s.add_runtime_dependency(%q<activerecord>, [">= 0"])
50
+ s.add_development_dependency(%q<jeweler>)
51
+ s.add_development_dependency(%q<yard>)
52
+ s.add_development_dependency(%q<redcarpet>)
53
+ s.add_development_dependency(%q<rspec>)
54
+ s.add_development_dependency(%q<factory_girl>)
55
+ s.add_development_dependency(%q<pg>)
56
+ s.add_development_dependency(%q<activerecord-jdbcpostgresql-adapter>)
58
57
  else
59
58
  s.add_dependency(%q<activerecord>, [">= 4.0"])
60
59
  s.add_dependency(%q<activesupport>, [">= 4.0"])
61
- s.add_dependency(%q<jeweler>, [">= 0"])
62
- s.add_dependency(%q<yard>, [">= 0"])
63
- s.add_dependency(%q<RedCloth>, [">= 0"])
64
- s.add_dependency(%q<rspec>, [">= 0"])
65
- s.add_dependency(%q<factory_girl>, [">= 0"])
66
- s.add_dependency(%q<pg>, [">= 0"])
67
- s.add_dependency(%q<activerecord-jdbcpostgresql-adapter>, [">= 0"])
68
- s.add_dependency(%q<activerecord>, [">= 0"])
60
+ s.add_dependency(%q<jeweler>)
61
+ s.add_dependency(%q<yard>)
62
+ s.add_dependency(%q<redcarpet>)
63
+ s.add_dependency(%q<rspec>)
64
+ s.add_dependency(%q<factory_girl>)
65
+ s.add_dependency(%q<pg>)
66
+ s.add_dependency(%q<activerecord-jdbcpostgresql-adapter>)
69
67
  end
70
68
  else
71
69
  s.add_dependency(%q<activerecord>, [">= 4.0"])
72
70
  s.add_dependency(%q<activesupport>, [">= 4.0"])
73
- s.add_dependency(%q<jeweler>, [">= 0"])
74
- s.add_dependency(%q<yard>, [">= 0"])
75
- s.add_dependency(%q<RedCloth>, [">= 0"])
76
- s.add_dependency(%q<rspec>, [">= 0"])
77
- s.add_dependency(%q<factory_girl>, [">= 0"])
78
- s.add_dependency(%q<pg>, [">= 0"])
79
- s.add_dependency(%q<activerecord-jdbcpostgresql-adapter>, [">= 0"])
80
- s.add_dependency(%q<activerecord>, [">= 0"])
71
+ s.add_dependency(%q<jeweler>)
72
+ s.add_dependency(%q<yard>)
73
+ s.add_dependency(%q<redcarpet>)
74
+ s.add_dependency(%q<rspec>)
75
+ s.add_dependency(%q<factory_girl>)
76
+ s.add_dependency(%q<pg>)
77
+ s.add_dependency(%q<activerecord-jdbcpostgresql-adapter>)
81
78
  end
82
79
  end
83
80
 
data/lib/enum_type.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'enum_type/extensions'
2
2
 
3
- # Adds the @enum_type@ method to a model.
3
+ # Adds the `enum_type` method to a model.
4
4
  #
5
5
  # @example Basic usage
6
6
  # class MyModel < ActiveRecord::Base
@@ -17,16 +17,19 @@ module EnumType
17
17
  # @overload enum_type(field, ..., options={})
18
18
  # @param [Symbol] field An enumerated field.
19
19
  # @param [Hash] options A hash of options.
20
- # @option options [true, false] :allow_nil (false) If @true@, a nil value
21
- # is allowed.
20
+ # @option options [true, false] :allow_nil (false) If `true`, a `nil` value
21
+ # is allowed.
22
22
  # @option options [Array<String>] :values If given, restricts valid values
23
- # to those in the given array.
23
+ # to those in the given array.
24
+ # @option options [String] :register_type If `true`, registers the column's
25
+ # type with the PostgreSQL adapter, to suppress "unknown OID" warnings.
24
26
  #
25
27
  # @example Enumerated field with restricted types
26
28
  # enum_type :color, values: %w( red orange yellow green blue purple )
27
29
 
28
30
  def enum_type(*fields)
29
31
  options = fields.extract_options!
32
+
30
33
  fields.each do |field|
31
34
  define_method field do
32
35
  value = read_attribute(field)
@@ -39,6 +42,19 @@ module EnumType
39
42
 
40
43
  validates_presence_of(field) unless options[:allow_nil]
41
44
  validates_inclusion_of(field, in: options[:values].map(&:to_sym), allow_nil: options[:allow_nil]) if options[:values]
45
+
46
+ if options[:register_type]
47
+ #ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID.register_type field.to_s,
48
+ # ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID::Identity.new
49
+ begin
50
+ result = connection.select_one("SELECT atttypid FROM pg_catalog.pg_attribute WHERE attrelid = #{connection.quote table_name}::regclass AND attname = #{connection.quote field.to_s}")
51
+ type_oid = Integer(result['atttypid'])
52
+ ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID::TYPE_MAP[type_oid] =
53
+ ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID::Identity.new
54
+ rescue => err
55
+ Rails.logger.warn "Couldn't register type #{field}: #{err}"
56
+ end
57
+ end
42
58
  end
43
59
  end
44
60
  end
@@ -1,8 +1,9 @@
1
1
  require 'active_support/core_ext/module/aliasing'
2
2
  require 'active_record/connection_adapters/postgresql_adapter'
3
3
 
4
- # Patch the PostgreSQL adapter to recognize defaults on ENUM columns.
4
+ # Patch the PostgreSQL adapter to recognize defaults on `ENUM` columns.
5
5
 
6
+ # @private
6
7
  class ActiveRecord::ConnectionAdapters::PostgreSQLColumn
7
8
 
8
9
  def initialize(name, default, oid_type, sql_type = nil, null = true)
@@ -36,6 +37,7 @@ class ActiveRecord::ConnectionAdapters::PostgreSQLColumn
36
37
  end
37
38
  end if ActiveRecord::ConnectionAdapters::PostgreSQLColumn.methods.include?(:extract_value_from_default)
38
39
 
40
+ # @private
39
41
  class ActiveRecord::ConnectionAdapters::JdbcColumn
40
42
  def initialize(config, name, default, *args)
41
43
  call_discovered_column_callbacks(config)
@@ -4,7 +4,7 @@ module SpecSupport
4
4
  class EnumTypeTester
5
5
  include ActiveModel::Validations
6
6
  extend EnumType
7
-
7
+
8
8
  def self.set_field(field)
9
9
  @field = field
10
10
  reset_callbacks :validate
@@ -37,31 +37,31 @@ describe EnumType do
37
37
  context "[getter]" do
38
38
  it "should return a symbol" do
39
39
  Model.connection.execute "INSERT INTO models (state) VALUES ('completed')"
40
- Model.last.state.should eql(:completed)
40
+ expect(Model.last.state).to eql(:completed)
41
41
  end
42
-
42
+
43
43
  it "should return nil if the value is nil" do
44
44
  Model.connection.execute "INSERT INTO models (state) VALUES (NULL)"
45
- Model.last.state.should be_nil
45
+ expect(Model.last.state).to be_nil
46
46
  end
47
47
  end
48
48
 
49
49
  context "[setter]" do
50
50
  it "should typecast the value to a string" do
51
- m = Model.new
51
+ m = Model.new
52
52
  m.state = :failed
53
- m.state.should eql(:failed)
53
+ expect(m.state).to eql(:failed)
54
54
  m.save!
55
- m.reload.state.should eql(:failed)
56
- m.state_before_type_cast.should eql('failed')
55
+ expect(m.reload.state).to eql(:failed)
56
+ expect(m.state_before_type_cast).to eql('failed')
57
57
  end
58
-
58
+
59
59
  it "should leave nil as nil" do
60
- m = Model.new
60
+ m = Model.new
61
61
  m.state = nil
62
- m.state.should eql(nil)
62
+ expect(m.state).to eql(nil)
63
63
  m.save!
64
- m.reload.state.should be_nil
64
+ expect(m.reload.state).to be_nil
65
65
  end
66
66
  end
67
67
 
@@ -71,38 +71,52 @@ describe EnumType do
71
71
  SpecSupport::EnumTypeTester.set_field(@field)
72
72
  @model = SpecSupport::EnumTypeTester.new
73
73
  end
74
-
74
+
75
75
  it "should validate inclusion if :values option is given" do
76
- SpecSupport::EnumTypeTester.enum_type @field, values: [ :a, :b ]
76
+ SpecSupport::EnumTypeTester.enum_type @field, values: [:a, :b]
77
77
  @model.send :"#{@field}=", :a
78
- @model.get.should eql('a')
79
- @model.should be_valid
78
+ expect(@model.get).to eql('a')
79
+ expect(@model).to be_valid
80
80
  @model.send :"#{@field}=", :c
81
- @model.should_not be_valid
81
+ expect(@model).not_to be_valid
82
82
  end
83
83
 
84
84
  it "should not validate presence if :allow_nil is true" do
85
85
  pending "Doesn't work"
86
86
  SpecSupport::EnumTypeTester.enum_type @field, allow_nil: true
87
87
  @model.send :"#{@field}=", nil
88
- @model.should be_valid
88
+ expect(@model).to be_valid
89
89
  end
90
-
90
+
91
91
  it "should validate presence if :allow_nil is not given" do
92
92
  SpecSupport::EnumTypeTester.enum_type @field
93
93
  @model.send :"#{@field}=", nil
94
- @model.should_not be_valid
94
+ expect(@model).not_to be_valid
95
95
  end
96
-
96
+
97
97
  it "should validate presence if :allow_nil is false" do
98
98
  SpecSupport::EnumTypeTester.enum_type @field, allow_nil: false
99
99
  @model.send :"#{@field}=", nil
100
- @model.should_not be_valid
100
+ expect(@model).not_to be_valid
101
101
  end
102
102
  end
103
-
103
+
104
+ context '[:register_type option]' do
105
+ before(:each) { @field = FactoryGirl.generate(:enum_field) }
106
+
107
+ it "should register each new PostgreSQL type with ActiveRecord when set" do
108
+ expect(Model.connection).
109
+ to receive(:select_one).once.
110
+ with(/SELECT atttypid FROM pg_catalog.pg_attribute WHERE attrelid = 'models'::regclass AND attname = '#{@field}'/).
111
+ and_return('atttypid' => '12345')
112
+ Model.enum_type @field, register_type: true
113
+ expect(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID::TYPE_MAP[12345]).
114
+ to be_kind_of(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID::Identity)
115
+ end
116
+ end
117
+
104
118
  it "should determine the correct column default" do
105
- Model.columns.detect { |c| c.name == 'state' }.default.should eql('pending')
119
+ expect(Model.columns.detect { |c| c.name == 'state' }.default).to eql('pending')
106
120
  end
107
121
  end
108
122
  end
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,5 @@
1
- Bundler.require :default, :test
1
+ require 'bundler'
2
+ Bundler.require :default, :development
2
3
 
3
4
  $LOAD_PATH.unshift(File.dirname(__FILE__))
4
5
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
metadata CHANGED
@@ -1,153 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enum_type
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-11 00:00:00.000000000 Z
11
+ date: 2013-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '4.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '4.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: jeweler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: yard
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: RedCloth
70
+ name: redcarpet
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: factory_girl
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: pg
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: activerecord-jdbcpostgresql-adapter
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: activerecord
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - '>='
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :runtime
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - '>='
136
+ - - ">="
151
137
  - !ruby/object:Gem::Version
152
138
  version: '0'
153
139
  description: Allows ActiveRecord to better use PostgreSQL's ENUM types.
@@ -156,16 +142,16 @@ executables: []
156
142
  extensions: []
157
143
  extra_rdoc_files:
158
144
  - LICENSE
159
- - README.textile
145
+ - README.md
160
146
  files:
161
- - .document
162
- - .rspec
163
- - .ruby-gemset
164
- - .ruby-version
147
+ - ".document"
148
+ - ".rspec"
149
+ - ".ruby-gemset"
150
+ - ".ruby-version"
165
151
  - Gemfile
166
152
  - Gemfile.lock
167
153
  - LICENSE
168
- - README.textile
154
+ - README.md
169
155
  - Rakefile
170
156
  - VERSION
171
157
  - enum_type.gemspec
@@ -183,18 +169,19 @@ require_paths:
183
169
  - lib
184
170
  required_ruby_version: !ruby/object:Gem::Requirement
185
171
  requirements:
186
- - - '>='
172
+ - - ">="
187
173
  - !ruby/object:Gem::Version
188
174
  version: '1.9'
189
175
  required_rubygems_version: !ruby/object:Gem::Requirement
190
176
  requirements:
191
- - - '>='
177
+ - - ">="
192
178
  - !ruby/object:Gem::Version
193
179
  version: '0'
194
180
  requirements: []
195
181
  rubyforge_project:
196
- rubygems_version: 2.1.10
182
+ rubygems_version: 2.2.0
197
183
  signing_key:
198
184
  specification_version: 4
199
185
  summary: PostgreSQL enumerated types in ActiveRecord
200
186
  test_files: []
187
+ has_rdoc:
data/README.textile DELETED
@@ -1,45 +0,0 @@
1
- h1. enum_type -- Enumerated Types in ActiveRecord
2
-
3
- | *Author* | Tim Morgan |
4
- | *Version* | 2.1.2 (Nov 10, 2013) |
5
- | *License* | Released under the MIT license. |
6
-
7
- h2. About
8
-
9
- @enum_type@ allows you to effectively use the PostgreSQL @ENUM@ data type in
10
- your ActiveRecord models. It's a really simple gem that just adds a convenience
11
- method to take care of the usual "witch chant" that accompanies building an
12
- enumerated type in Rails.
13
-
14
- h2. Installation
15
-
16
- *Important Note:* This gem requires Ruby 1.9. Ruby 1.8 is not supported, and
17
- will never be.
18
-
19
- First, add the @enum_type@ gem to your @Gemfile@:
20
-
21
- <pre><code>
22
- gem 'enum_type'
23
- </code></pre>
24
-
25
- Then, extend your model with the @EnumType@ module:
26
-
27
- <pre><code>
28
- class MyModel < ActiveRecord::Base
29
- extend EnumType
30
- end
31
- </code></pre>
32
-
33
- h2. Usage
34
-
35
- In your model, call the @enum_type@ method, providing one or more enumerated
36
- fields, and any additional options:
37
-
38
- <pre><code>
39
- class MyModel < ActiveRecord::Base
40
- extend EnumType
41
- enum_type :status, %w( active pending admin superadmin banned )
42
- end
43
- </code></pre>
44
-
45
- See the {EnumType#enum_type} method documentation for more information.