simple_enum 1.6.9 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile +9 -6
- data/LICENSE +1 -1
- data/README.md +331 -0
- data/Rakefile +9 -17
- data/lib/simple_enum/accessors/accessor.rb +61 -0
- data/lib/simple_enum/accessors/ignore_accessor.rb +11 -0
- data/lib/simple_enum/accessors/whiny_accessor.rb +12 -0
- data/lib/simple_enum/accessors.rb +28 -0
- data/lib/simple_enum/attribute.rb +109 -0
- data/lib/simple_enum/enum.rb +58 -0
- data/lib/simple_enum/hasher.rb +26 -0
- data/lib/simple_enum/mongoid.rb +16 -18
- data/lib/simple_enum/railtie.rb +17 -0
- data/lib/simple_enum/translation.rb +21 -0
- data/lib/simple_enum/version.rb +2 -2
- data/lib/simple_enum/view_helpers.rb +55 -0
- data/lib/simple_enum.rb +22 -278
- data/simple_enum.gemspec +9 -9
- data/spec/simple_enum/accessors_spec.rb +298 -0
- data/spec/simple_enum/attribute_spec.rb +272 -0
- data/spec/simple_enum/enum_spec.rb +136 -0
- data/spec/simple_enum/hasher_spec.rb +63 -0
- data/spec/simple_enum/mongoid_spec.rb +44 -0
- data/spec/simple_enum/translation_spec.rb +70 -0
- data/spec/simple_enum/view_helpers_spec.rb +71 -0
- data/spec/spec_helper.rb +27 -0
- data/spec/support/active_record_support.rb +27 -0
- data/spec/support/i18n_support.rb +12 -0
- data/spec/support/model_support.rb +47 -0
- data/spec/support/mongoid_support.rb +47 -0
- metadata +55 -57
- data/README.rdoc +0 -293
- data/lib/simple_enum/enum_hash.rb +0 -64
- data/lib/simple_enum/validation.rb +0 -58
- data/locales/en.yml +0 -10
- data/test/array_conversions_test.rb +0 -21
- data/test/class_methods_test.rb +0 -114
- data/test/dirty_attributes_test.rb +0 -37
- data/test/enum_hash_test.rb +0 -73
- data/test/finders_test.rb +0 -45
- data/test/locales.yml +0 -25
- data/test/mongoid_test.rb +0 -66
- data/test/object_backed_test.rb +0 -61
- data/test/orm/active_record.rb +0 -114
- data/test/orm/common.rb +0 -23
- data/test/orm/mongoid.rb +0 -114
- data/test/poro_test.rb +0 -20
- data/test/prefixes_test.rb +0 -36
- data/test/simple_enum_test.rb +0 -314
- data/test/test_helper.rb +0 -40
- data/test/without_shortcuts_test.rb +0 -39
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'simple_enum/hasher'
|
3
|
+
|
4
|
+
describe SimpleEnum::Hasher do
|
5
|
+
subject { described_class }
|
6
|
+
|
7
|
+
context '.map' do
|
8
|
+
subject { described_class.map(%w{male female}, map: :string) }
|
9
|
+
|
10
|
+
it 'uses DefaultHasher by default' do
|
11
|
+
result = { "male" => 0, "female" => 1 }
|
12
|
+
expect(described_class.map(%w{male female})).to eq result
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'returns a frozen Hash' do
|
16
|
+
expect(subject).to be_a(Hash)
|
17
|
+
expect(subject).to be_frozen
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'uses the builder supplied if available' do
|
21
|
+
result = { "male" => "male", "female" => "female" }
|
22
|
+
expect(subject).to eq result
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'accepts a Proc as well' do
|
26
|
+
proc = ->(hash) { { "static" => 1 } }
|
27
|
+
result = { "static" => 1 }
|
28
|
+
expect(described_class.map(%w{male female}, map: proc) ).to eq result
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'DefaultHasher.call' do
|
33
|
+
let(:result) do; { "male" => 0, "female" => 1 } end
|
34
|
+
|
35
|
+
it 'returns string => index for Array of strings' do
|
36
|
+
expect(subject::DefaultHasher.call(%w{male female})).to eq result
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'returns string => index for Array of symbols' do
|
40
|
+
expect(subject::DefaultHasher.call([:male, :female])).to eq result
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'returns string => number for Hash with symbolized keys' do
|
44
|
+
expect(subject::DefaultHasher.call(male: 0, female: 1)).to eq result
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'returns string => number for hash with string keys' do
|
48
|
+
expect(subject::DefaultHasher.call('male' => 0, 'female' => 1)).to eq result
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context 'StringHasher.call' do
|
53
|
+
let(:result) do; { "male" => "male", "female" => "female" } end
|
54
|
+
|
55
|
+
it 'retuns string => string for Array of strings' do
|
56
|
+
expect(subject::StringHasher.call(%w{male female})).to eq result
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'returns string => string for Array of symbols' do
|
60
|
+
expect(subject::StringHasher.call([:male, :female])).to eq result
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'simple_enum/mongoid'
|
3
|
+
|
4
|
+
describe SimpleEnum::Mongoid, mongoid: true do
|
5
|
+
fake_mongoid_model(:klass) {
|
6
|
+
as_enum :gender, %w{male female}
|
7
|
+
}
|
8
|
+
|
9
|
+
let(:field) { klass.fields['gender_cd'] }
|
10
|
+
|
11
|
+
context '.as_enum' do
|
12
|
+
subject { klass }
|
13
|
+
|
14
|
+
it 'has the genders enum' do
|
15
|
+
expect(klass.genders).to be_a(SimpleEnum::Enum)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'creates the :gender_cd field' do
|
19
|
+
expect(field).to_not be_nil
|
20
|
+
expect(field.type).to eq Object
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'field: { type: Integer }' do
|
24
|
+
fake_mongoid_model(:klass) {
|
25
|
+
as_enum :gender, %w{male female}, field: { type: Integer }
|
26
|
+
}
|
27
|
+
|
28
|
+
it 'creates the :gender_cd field as Integer' do
|
29
|
+
expect(field).to_not be_nil
|
30
|
+
expect(field.type).to eq Integer
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'field: false' do
|
35
|
+
fake_mongoid_model(:klass) {
|
36
|
+
as_enum :gender, %w{male female}, field: false
|
37
|
+
}
|
38
|
+
|
39
|
+
it 'does not create the field' do
|
40
|
+
expect(field).to be_nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SimpleEnum::Translation do
|
4
|
+
context '.human_enum_name', i18n: true do
|
5
|
+
fake_model(:klass) { extend SimpleEnum::Translation }
|
6
|
+
subject { klass }
|
7
|
+
|
8
|
+
shared_examples_for 'translating gender' do
|
9
|
+
it 'translates :male to "Mr."' do
|
10
|
+
expect(subject.human_enum_name(:gender, :male)).to eq 'Mr.'
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'translates :female to "Mrs."' do
|
14
|
+
expect(subject.human_enum_name(:gender, :female)).to eq 'Mrs.'
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'returns empty string when key is missing' do
|
18
|
+
expect(subject.human_enum_name(:gender, nil)).to eq ''
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
context '{i18n_scope}.enums.{i18n_key}.gender.{key}' do
|
23
|
+
before do
|
24
|
+
store_translations :en, 'activemodel' => {
|
25
|
+
'enums' => {
|
26
|
+
'fake_model' => {
|
27
|
+
'gender' => { 'male' => 'Mr.', 'female' => 'Mrs.' }
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
it_behaves_like 'translating gender'
|
34
|
+
end
|
35
|
+
|
36
|
+
context 'enums.{i18n_key}.gender.{key}' do
|
37
|
+
before do
|
38
|
+
store_translations :en, 'enums' => {
|
39
|
+
'fake_model' => {
|
40
|
+
'gender' => { 'male' => 'Mr.', 'female' => 'Mrs.' }
|
41
|
+
}
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
it_behaves_like 'translating gender'
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'enums.gender.{key}' do
|
49
|
+
before do
|
50
|
+
store_translations :en, 'enums' => {
|
51
|
+
'gender' => { 'male' => 'Mr.', 'female' => 'Mrs.' }
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
it_behaves_like 'translating gender'
|
56
|
+
end
|
57
|
+
|
58
|
+
context 'uses :default if available' do
|
59
|
+
it 'translates :female to "Frau" using default:' do
|
60
|
+
expect(subject.human_enum_name(:gender, :female, default: 'Frau')).to eq 'Frau'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context 'falls back to titleize' do
|
65
|
+
it 'translates using .titleize if no translations found' do
|
66
|
+
expect(subject.human_enum_name(:gender, :female)).to eq 'Female'
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SimpleEnum::ViewHelpers, i18n: true do
|
4
|
+
let(:helper) {
|
5
|
+
Class.new do
|
6
|
+
include SimpleEnum::ViewHelpers
|
7
|
+
end.new
|
8
|
+
}
|
9
|
+
|
10
|
+
fake_model(:klass) do
|
11
|
+
as_enum :gender, %w{male female}
|
12
|
+
end
|
13
|
+
|
14
|
+
context '#enum_option_pairs' do
|
15
|
+
subject { helper.enum_option_pairs(klass, :gender) }
|
16
|
+
|
17
|
+
it 'returns an Array of Arrays when a model instance is passed in' do
|
18
|
+
expect(helper.enum_option_pairs(klass.new, :gender)).to eq [
|
19
|
+
["Male", "male"], ["Female", "female"]
|
20
|
+
]
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'returns an Array of Array when the class is passed in' do
|
24
|
+
expect(subject).to eq [
|
25
|
+
["Male", "male"], ["Female", "female"]
|
26
|
+
]
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'returns the value instead of the key when last argument is set to true' do
|
30
|
+
expect(helper.enum_option_pairs(klass, :gender, true)).to eq [
|
31
|
+
["Male", 0], ["Female", 1]
|
32
|
+
]
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'with translation in enums.{...}' do
|
36
|
+
before {
|
37
|
+
store_translations :en, 'enums' => {
|
38
|
+
'gender' => { 'male' => 'Mr.', 'female' => 'Mrs.' }
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
it 'returns the translation as defined in the translations' do
|
43
|
+
expect(subject).to eq [
|
44
|
+
["Mr.", "male"], ["Mrs.", "female"]
|
45
|
+
]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context 'with .human_enum_name' do
|
50
|
+
before {
|
51
|
+
expect(klass).to receive(:human_enum_name).with(:gender, "male") { "Mr." }
|
52
|
+
expect(klass).to receive(:human_enum_name).with(:gender, "female") { "Mrs." }
|
53
|
+
}
|
54
|
+
|
55
|
+
it 'returns the translation as given #human_enum_name' do
|
56
|
+
expect(subject).to eq [
|
57
|
+
["Mr.", "male"], ["Mrs.", "female"]
|
58
|
+
]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context '#translate_enum' do
|
64
|
+
let(:fake_object) { klass.new }
|
65
|
+
it "translates with object scope" do
|
66
|
+
fake_object.gender = :male
|
67
|
+
expect(klass).to receive(:human_enum_name).with(:gender, :male) { "Mr." }
|
68
|
+
expect(helper.translate_enum(fake_object, :gender)).to eq "Mr."
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
require 'rspec'
|
5
|
+
require 'active_record'
|
6
|
+
require 'mongoid'
|
7
|
+
|
8
|
+
if ENV['CODECLIMATE_REPO_TOKEN']
|
9
|
+
require 'simplecov'
|
10
|
+
SimpleCov.start
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'simple_enum'
|
14
|
+
|
15
|
+
require 'support/active_record_support'
|
16
|
+
require 'support/i18n_support'
|
17
|
+
require 'support/model_support'
|
18
|
+
require 'support/mongoid_support'
|
19
|
+
|
20
|
+
I18n.enforce_available_locales = false
|
21
|
+
|
22
|
+
RSpec.configure do |config|
|
23
|
+
config.include ModelSupport
|
24
|
+
config.include I18nSupport, i18n: true
|
25
|
+
config.include ActiveRecordSupport, active_record: true
|
26
|
+
config.include MongoidSupport, mongoid: true
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module ActiveRecordSupport
|
2
|
+
def self.connection
|
3
|
+
@connection_pool ||= ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
|
4
|
+
ActiveRecord::Base.connection
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.included(base)
|
8
|
+
base.before(:each) { self.reset_active_record }
|
9
|
+
end
|
10
|
+
|
11
|
+
def reset_active_record
|
12
|
+
ActiveRecordSupport.connection.create_table :dummies, :force => true do |t|
|
13
|
+
t.column :name, :string
|
14
|
+
t.column :gender_cd, :integer
|
15
|
+
t.column :word_cd, :string, :limit => 5
|
16
|
+
t.column :role_cd, :string
|
17
|
+
t.column :other, :integer
|
18
|
+
t.column :numeric_cd, :string
|
19
|
+
t.column :nilish_cd, :string
|
20
|
+
t.column :style_cd, :integer
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# Behave like the railtie.rb
|
26
|
+
ActiveRecord::Base.send :extend, SimpleEnum::Attribute
|
27
|
+
ActiveRecord::Base.send :extend, SimpleEnum::Translation
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module I18nSupport
|
2
|
+
def self.included(base)
|
3
|
+
base.let!(:i18n_previous_backend) { I18n.backend }
|
4
|
+
base.let(:i18n_backend) { I18n::Backend::Simple.new() }
|
5
|
+
base.before { I18n.backend = i18n_backend }
|
6
|
+
base.after { I18n.backend = i18n_previous_backend }
|
7
|
+
end
|
8
|
+
|
9
|
+
def store_translations(lang, translations)
|
10
|
+
i18n_backend.store_translations lang, translations
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
require 'mongoid'
|
3
|
+
|
4
|
+
module ModelSupport
|
5
|
+
def self.included(base)
|
6
|
+
base.extend ClassMethods
|
7
|
+
end
|
8
|
+
|
9
|
+
module ClassMethods
|
10
|
+
|
11
|
+
def fake_active_record(name, &block)
|
12
|
+
let(name) {
|
13
|
+
Class.new(ActiveRecord::Base) do
|
14
|
+
self.table_name = 'dummies'
|
15
|
+
instance_eval &block
|
16
|
+
end
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
def fake_mongoid_model(name, &block)
|
21
|
+
let(name) {
|
22
|
+
Class.new do
|
23
|
+
include Mongoid::Document
|
24
|
+
include SimpleEnum::Mongoid
|
25
|
+
|
26
|
+
store_in collection: 'dummies'
|
27
|
+
instance_eval &block
|
28
|
+
end
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def fake_model(name, *fields, &block)
|
33
|
+
fields << :gender_cd
|
34
|
+
let(name) {
|
35
|
+
Struct.new(*fields) do
|
36
|
+
extend ActiveModel::Translation
|
37
|
+
extend SimpleEnum::Attribute
|
38
|
+
instance_eval &block if block_given?
|
39
|
+
|
40
|
+
def self.model_name
|
41
|
+
@model_name ||= ActiveModel::Name.new(self, nil, "FakeModel")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'mongoid'
|
2
|
+
|
3
|
+
# Hack to disable auto-retries for Mongo::Client - unless running
|
4
|
+
# on Travis CI
|
5
|
+
if ENV['CI'] && Mongoid.respond_to?(:default_client)
|
6
|
+
require 'mongo'
|
7
|
+
|
8
|
+
module Mongo
|
9
|
+
class Cluster
|
10
|
+
def scan!
|
11
|
+
raise ArgumentError, 'no retries please.'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
module MongoidSupport
|
18
|
+
def self.connection
|
19
|
+
@connection_config ||= begin
|
20
|
+
Mongoid.configure do |config|
|
21
|
+
config.connect_to("simple_enum_mongoid_test", max_retries: ENV['CI'] ? 5 : 0)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Disable client errors
|
25
|
+
Moped.logger.level = Logger::ERROR if defined?(Moped)
|
26
|
+
Mongo::Logger.logger.level = Logger::ERROR if defined?(Mongo)
|
27
|
+
|
28
|
+
# Return instance
|
29
|
+
return Mongoid.default_client if Mongoid.respond_to?(:default_client)
|
30
|
+
Mongoid.default_session
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.included(base)
|
35
|
+
base.before {
|
36
|
+
begin
|
37
|
+
MongoidSupport.connection.database_names
|
38
|
+
rescue => e
|
39
|
+
if ENV['CI']
|
40
|
+
raise e
|
41
|
+
else
|
42
|
+
skip "Start MongoDB server to run Mongoid integration tests..."
|
43
|
+
end
|
44
|
+
end
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_enum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukas Westermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,70 +16,70 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.0.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
|
-
version:
|
26
|
+
version: 4.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 10.1.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 10.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: activerecord
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 4.0.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
|
-
version:
|
54
|
+
version: 4.0.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: mongoid
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 4.0.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
|
-
version:
|
68
|
+
version: 4.0.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '2.
|
75
|
+
version: '2.14'
|
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
|
-
version: '2.
|
82
|
+
version: '2.14'
|
83
83
|
description: Provides enum-like fields for ActiveRecord, ActiveModel and Mongoid models.
|
84
84
|
email:
|
85
85
|
- lukas.westermann@gmail.com
|
@@ -90,31 +90,34 @@ files:
|
|
90
90
|
- ".gitignore"
|
91
91
|
- Gemfile
|
92
92
|
- LICENSE
|
93
|
-
- README.
|
93
|
+
- README.md
|
94
94
|
- Rakefile
|
95
95
|
- lib/simple_enum.rb
|
96
|
-
- lib/simple_enum/
|
96
|
+
- lib/simple_enum/accessors.rb
|
97
|
+
- lib/simple_enum/accessors/accessor.rb
|
98
|
+
- lib/simple_enum/accessors/ignore_accessor.rb
|
99
|
+
- lib/simple_enum/accessors/whiny_accessor.rb
|
100
|
+
- lib/simple_enum/attribute.rb
|
101
|
+
- lib/simple_enum/enum.rb
|
102
|
+
- lib/simple_enum/hasher.rb
|
97
103
|
- lib/simple_enum/mongoid.rb
|
98
|
-
- lib/simple_enum/
|
104
|
+
- lib/simple_enum/railtie.rb
|
105
|
+
- lib/simple_enum/translation.rb
|
99
106
|
- lib/simple_enum/version.rb
|
100
|
-
-
|
107
|
+
- lib/simple_enum/view_helpers.rb
|
101
108
|
- simple_enum.gemspec
|
102
|
-
-
|
103
|
-
-
|
104
|
-
-
|
105
|
-
-
|
106
|
-
-
|
107
|
-
-
|
108
|
-
-
|
109
|
-
-
|
110
|
-
-
|
111
|
-
-
|
112
|
-
-
|
113
|
-
-
|
114
|
-
- test/prefixes_test.rb
|
115
|
-
- test/simple_enum_test.rb
|
116
|
-
- test/test_helper.rb
|
117
|
-
- test/without_shortcuts_test.rb
|
109
|
+
- spec/simple_enum/accessors_spec.rb
|
110
|
+
- spec/simple_enum/attribute_spec.rb
|
111
|
+
- spec/simple_enum/enum_spec.rb
|
112
|
+
- spec/simple_enum/hasher_spec.rb
|
113
|
+
- spec/simple_enum/mongoid_spec.rb
|
114
|
+
- spec/simple_enum/translation_spec.rb
|
115
|
+
- spec/simple_enum/view_helpers_spec.rb
|
116
|
+
- spec/spec_helper.rb
|
117
|
+
- spec/support/active_record_support.rb
|
118
|
+
- spec/support/i18n_support.rb
|
119
|
+
- spec/support/model_support.rb
|
120
|
+
- spec/support/mongoid_support.rb
|
118
121
|
homepage: http://lwe.github.com/simple_enum/
|
119
122
|
licenses:
|
120
123
|
- MIT
|
@@ -127,33 +130,28 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
127
130
|
requirements:
|
128
131
|
- - ">="
|
129
132
|
- !ruby/object:Gem::Version
|
130
|
-
version: 1.
|
133
|
+
version: 1.9.3
|
131
134
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
135
|
requirements:
|
133
136
|
- - ">="
|
134
137
|
- !ruby/object:Gem::Version
|
135
|
-
version:
|
138
|
+
version: 2.0.0
|
136
139
|
requirements: []
|
137
140
|
rubyforge_project:
|
138
|
-
rubygems_version: 2.
|
141
|
+
rubygems_version: 2.6.13
|
139
142
|
signing_key:
|
140
143
|
specification_version: 4
|
141
144
|
summary: Simple enum-like field support for models.
|
142
145
|
test_files:
|
143
|
-
-
|
144
|
-
-
|
145
|
-
-
|
146
|
-
-
|
147
|
-
-
|
148
|
-
-
|
149
|
-
-
|
150
|
-
-
|
151
|
-
-
|
152
|
-
-
|
153
|
-
-
|
154
|
-
-
|
155
|
-
- test/poro_test.rb
|
156
|
-
- test/prefixes_test.rb
|
157
|
-
- test/simple_enum_test.rb
|
158
|
-
- test/test_helper.rb
|
159
|
-
- test/without_shortcuts_test.rb
|
146
|
+
- spec/simple_enum/accessors_spec.rb
|
147
|
+
- spec/simple_enum/attribute_spec.rb
|
148
|
+
- spec/simple_enum/enum_spec.rb
|
149
|
+
- spec/simple_enum/hasher_spec.rb
|
150
|
+
- spec/simple_enum/mongoid_spec.rb
|
151
|
+
- spec/simple_enum/translation_spec.rb
|
152
|
+
- spec/simple_enum/view_helpers_spec.rb
|
153
|
+
- spec/spec_helper.rb
|
154
|
+
- spec/support/active_record_support.rb
|
155
|
+
- spec/support/i18n_support.rb
|
156
|
+
- spec/support/model_support.rb
|
157
|
+
- spec/support/mongoid_support.rb
|