rails_admin-auto-enum 0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2b3c134099175c2e58016639ea982a57113d54c3
4
+ data.tar.gz: 9d3cae0c11750d6701cb9a32c50224deb5d0a66c
5
+ SHA512:
6
+ metadata.gz: 371ffa9ddad90b481048da08784927e04de28ef219fe9365d2ac02d4c8fa839044e5efdb597a20620d3215a28b5a2fb2e53ab78c90ad85facb4ac22b07723bd6
7
+ data.tar.gz: 9cb4f436dbaaadd8bebbec16736a0bd1125d2142e81d07539e08163ee9a7567d1f8c80b39114f5394c3b27138c93798e39d6242fc68cd6e2cfcd367860f63aef
@@ -0,0 +1,27 @@
1
+ #--
2
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
+ # Version 2, December 2004
4
+ #
5
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
6
+ # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
7
+ #
8
+ # 0. You just DO WHAT THE FUCK YOU WANT TO.
9
+ #++
10
+
11
+ module RailsAdminAutoEnum
12
+ module ActiveRecord
13
+ module RailsAdminEnum
14
+ def enum(definitions)
15
+ super
16
+
17
+ definitions.each do |name, values|
18
+ define_method("#{name}_enum") { self.class.send(name.to_s.pluralize).to_a }
19
+
20
+ define_method("#{name}=") do |value|
21
+ super value.kind_of?(String) && value.to_i.to_s == value ? value.to_i : value
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,17 @@
1
+ #--
2
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
+ # Version 2, December 2004
4
+ #
5
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
6
+ # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
7
+ #
8
+ # 0. You just DO WHAT THE FUCK YOU WANT TO.
9
+ #++
10
+
11
+ module RailsAdminAutoEnum
12
+ class Railtie < Rails::Railtie
13
+ initializer 'rails_admin.auto_enum' do |config|
14
+ ActiveRecord::Base.send(:extend, RailsAdminAutoEnum::ActiveRecord::RailsAdminEnum)
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ #--
2
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
+ # Version 2, December 2004
4
+ #
5
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
6
+ # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
7
+ #
8
+ # 0. You just DO WHAT THE FUCK YOU WANT TO.
9
+ #++
10
+
11
+ module RailsAdminAutoEnum
12
+ VERSION = '0.1'
13
+ end
@@ -0,0 +1,13 @@
1
+ #--
2
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
3
+ # Version 2, December 2004
4
+ #
5
+ # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
6
+ # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
7
+ #
8
+ # 0. You just DO WHAT THE FUCK YOU WANT TO.
9
+ #++
10
+
11
+ require 'rails_admin-auto-enum/rails_admin'
12
+ require 'rails_admin-auto-enum/railtie'
13
+ require 'rails_admin-auto-enum/version'
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_admin-auto-enum
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Giovanni Capuano
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails_admin
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.6'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.6'
27
+ description: Provide enum fields for the fields that really need them, automatically.
28
+ An example of use could be with seralized objects.
29
+ email: webmaster@giovannicapuano.net
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - lib/rails_admin-auto-enum.rb
35
+ - lib/rails_admin-auto-enum/rails_admin.rb
36
+ - lib/rails_admin-auto-enum/railtie.rb
37
+ - lib/rails_admin-auto-enum/version.rb
38
+ homepage: https://github.com/RoxasShadow
39
+ licenses:
40
+ - WTFPL
41
+ metadata: {}
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ requirements: []
57
+ rubyforge_project:
58
+ rubygems_version: 2.2.2
59
+ signing_key:
60
+ specification_version: 4
61
+ summary: Provide enum fields for the fields that really need them.
62
+ test_files: []