nx-permit-fields 0.1.1 → 0.1.2

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
  SHA256:
3
- metadata.gz: 2f665ebb0945fa19c020977fa0a368909c774cb7f875659cf92bb7fe3d0c6b52
4
- data.tar.gz: 29d2bd749113c7afa80478f58cdcc54e298f688de57837f5d67d98f8639dbf77
3
+ metadata.gz: c9e0842da11b771f97ca668fce61530e91a13d77c0ca5b0119815226e2210850
4
+ data.tar.gz: b94be0ff1d653d645f1049536882bd5b32c4e5e45d4d527d8acee50a5ebb40e4
5
5
  SHA512:
6
- metadata.gz: 5d692bccdc6211777c35442b8716bfbcd9357ffa42391bc0913d2cbee6ac86b1a1d7144380da8d338efed1022e91485d2d1a72d6fcadbd000c16057ce8212b66
7
- data.tar.gz: 7d389f9d1abeb8a643f2042065084e32acb9de47a47140144576079f6c1041486ecb9dfbfbcf9ec51c9069b6ade3a4d176769788f621742546d7626b9996ad69
6
+ metadata.gz: b50f9d73d1aec6e69c50f0e6150cfa30b220e5567ca3840aac51e0ab3e0551015047750c3588446a15791d302cfaad7ce436aef0a6933bfabbcf29b75162cfbc
7
+ data.tar.gz: d7644faae214f6677f8738cd5b1394bf25aa0e3cfcf1db5847c2e448f60cf1f218ea9e5de286580fe2c91ae5f563cb81b6cde6e68567359d643668823530a363
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in templates.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # nx-permit-fields
2
+ > Permit fields for rails.
3
+
4
+ ## installation
5
+ ```rb
6
+ # from gem
7
+ gem 'nx-permit-fields'
8
+ # from git
9
+ gem 'nx-permit-fields', git: 'git@github.com:afeiship/nx-permit-fields.git'
10
+ ```
11
+
12
+ ## usage
13
+ ```rb
14
+ Nx::PermitFields::hello
15
+
16
+ # hello world
17
+ ```
18
+
19
+ ## build/publish
20
+ ```shell
21
+ # build
22
+ gem build nx-permit-fields.gemspec
23
+
24
+ # publish
25
+ gem push nx-permit-fields-0.1.0.gem
26
+ ```
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "nx-permit-fields"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,19 @@
1
+ module Nx
2
+ class PermitFields
3
+ def self.exclude(in_table_name, in_options)
4
+ default_options = {
5
+ base_fields: [
6
+ :id,
7
+ :created_at,
8
+ :updated_at,
9
+ ],
10
+ fields: [],
11
+ }
12
+
13
+ options = default_options.merge(in_options)
14
+ clazz = Kernel.const_get(in_table_name.capitalize)
15
+ fields = clazz.columns_hash.keys.map(&:to_sym)
16
+ fields - options[:base_fields] - options[:fields]
17
+ end
18
+ end
19
+ end
data/lib/nx/version.rb ADDED
@@ -0,0 +1,5 @@
1
+ module Nx
2
+ class PermitFields
3
+ VERSION = "0.1.2"
4
+ end
5
+ end
Binary file
@@ -0,0 +1,35 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "nx/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "nx-permit-fields"
8
+ spec.version = Nx::PermitFields::VERSION
9
+ spec.licenses = ["MIT"]
10
+ spec.authors = ["afeiship"]
11
+ spec.email = ["1290657123@qq.com"]
12
+
13
+ spec.summary = %q{Permit fields for rails with exculde.}
14
+ spec.description = %q{Permit fields for rails.}
15
+ spec.homepage = "https://github.com/afeiship/nx-permit-fields"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against " \
23
+ "public gem pushes."
24
+ end
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features)/})
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_development_dependency "bundler", "~> 1.14"
34
+ spec.add_development_dependency "rake", "~> 12.3", ">= 12.3.3"
35
+ end
data/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "nx-permit-fields",
3
+ "version": "1.0.0",
4
+ "description": "Permit fields for rails.",
5
+ "directories": {
6
+ "lib": "lib"
7
+ },
8
+ "scripts": {
9
+ "clean": "rm -rf *.gem",
10
+ "build": "gem build *.gemspec",
11
+ "pubpush": "gem push *.gem",
12
+ "unpublish":"gem yank nx-http -v '0.1.0'"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/afeiship/nx-permit-fields.git"
17
+ },
18
+ "author": "afei",
19
+ "license": "MIT",
20
+ "bugs": {
21
+ "url": "https://github.com/afeiship/nx-permit-fields/issues"
22
+ },
23
+ "homepage": "https://github.com/afeiship/nx-permit-fields#readme"
24
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nx-permit-fields
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - afeiship
@@ -51,7 +51,18 @@ executables: []
51
51
  extensions: []
52
52
  extra_rdoc_files: []
53
53
  files:
54
+ - ".gitignore"
55
+ - Gemfile
56
+ - README.md
57
+ - Rakefile
58
+ - bin/console
59
+ - bin/setup
54
60
  - lib/nx-permit-fields.rb
61
+ - lib/nx/permit-fields.rb
62
+ - lib/nx/version.rb
63
+ - nx-permit-fields-0.1.1.gem
64
+ - nx-permit-fields.gemspec
65
+ - package.json
55
66
  homepage: https://github.com/afeiship/nx-permit-fields
56
67
  licenses:
57
68
  - MIT