model_subsets 0.0.10 → 0.0.11
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.
- data/.gitignore +17 -17
- data/Gemfile +4 -4
- data/LICENSE +21 -21
- data/README.md +29 -29
- data/Rakefile +2 -2
- data/lib/model_subsets.rb +1 -24
- data/lib/model_subsets/version.rb +1 -1
- data/model_subsets.gemspec +20 -20
- metadata +3 -3
data/.gitignore
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
*.gem
|
|
2
|
-
*.rbc
|
|
3
|
-
.bundle
|
|
4
|
-
.config
|
|
5
|
-
.yardoc
|
|
6
|
-
Gemfile.lock
|
|
7
|
-
InstalledFiles
|
|
8
|
-
_yardoc
|
|
9
|
-
coverage
|
|
10
|
-
doc/
|
|
11
|
-
lib/bundler/man
|
|
12
|
-
pkg
|
|
13
|
-
rdoc
|
|
14
|
-
spec/reports
|
|
15
|
-
test/tmp
|
|
16
|
-
test/version_tmp
|
|
17
|
-
tmp
|
|
1
|
+
*.gem
|
|
2
|
+
*.rbc
|
|
3
|
+
.bundle
|
|
4
|
+
.config
|
|
5
|
+
.yardoc
|
|
6
|
+
Gemfile.lock
|
|
7
|
+
InstalledFiles
|
|
8
|
+
_yardoc
|
|
9
|
+
coverage
|
|
10
|
+
doc/
|
|
11
|
+
lib/bundler/man
|
|
12
|
+
pkg
|
|
13
|
+
rdoc
|
|
14
|
+
spec/reports
|
|
15
|
+
test/tmp
|
|
16
|
+
test/version_tmp
|
|
17
|
+
tmp
|
data/Gemfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
source 'https://rubygems.org'
|
|
2
|
-
|
|
3
|
-
# Specify your gem's dependencies in model_subsets.gemspec
|
|
4
|
-
gemspec
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# Specify your gem's dependencies in model_subsets.gemspec
|
|
4
|
+
gemspec
|
data/LICENSE
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
Copyright (c) 2012 Gauthier Delacroix
|
|
2
|
-
|
|
3
|
-
MIT License
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
a copy of this software and associated documentation files (the
|
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
-
the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
|
14
|
-
included in all copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
1
|
+
Copyright (c) 2012 Gauthier Delacroix
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
22
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
# ModelSubsets
|
|
2
|
-
|
|
3
|
-
Model Subsets provides subsets management for models.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
Add this line to your application's Gemfile:
|
|
8
|
-
|
|
9
|
-
gem 'model_subsets'
|
|
10
|
-
|
|
11
|
-
And then execute:
|
|
12
|
-
|
|
13
|
-
$ bundle
|
|
14
|
-
|
|
15
|
-
Or install it yourself as:
|
|
16
|
-
|
|
17
|
-
$ gem install model_subsets
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
TODO: Write usage instructions here
|
|
22
|
-
|
|
23
|
-
## Contributing
|
|
24
|
-
|
|
25
|
-
1. Fork it
|
|
26
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
27
|
-
3. Commit your changes (`git commit -am 'Added some feature'`)
|
|
28
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
|
29
|
-
5. Create new Pull Request
|
|
1
|
+
# ModelSubsets
|
|
2
|
+
|
|
3
|
+
Model Subsets provides subsets management for models.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
gem 'model_subsets'
|
|
10
|
+
|
|
11
|
+
And then execute:
|
|
12
|
+
|
|
13
|
+
$ bundle
|
|
14
|
+
|
|
15
|
+
Or install it yourself as:
|
|
16
|
+
|
|
17
|
+
$ gem install model_subsets
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
TODO: Write usage instructions here
|
|
22
|
+
|
|
23
|
+
## Contributing
|
|
24
|
+
|
|
25
|
+
1. Fork it
|
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
27
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#!/usr/bin/env rake
|
|
2
|
-
require "bundler/gem_tasks"
|
|
1
|
+
#!/usr/bin/env rake
|
|
2
|
+
require "bundler/gem_tasks"
|
data/lib/model_subsets.rb
CHANGED
|
@@ -186,6 +186,7 @@ module ModelSubsets
|
|
|
186
186
|
|
|
187
187
|
# Cleanup
|
|
188
188
|
options[:fieldsets] = options[:fieldsets].uniq & @fieldsets.keys
|
|
189
|
+
options[:group] ||= :default
|
|
189
190
|
remove_options = [:extends, :add, :only, :except]
|
|
190
191
|
options = options.clone
|
|
191
192
|
options.delete_if{ |key, value| remove_options.include?(key) }
|
|
@@ -225,30 +226,6 @@ module ModelSubsets
|
|
|
225
226
|
@subsets.reject{ |name, options| options[:template] }
|
|
226
227
|
end
|
|
227
228
|
|
|
228
|
-
# Provides grouped subsets list, formatted for use with grouped collection select
|
|
229
|
-
#
|
|
230
|
-
# @return [ Array ]
|
|
231
|
-
#
|
|
232
|
-
# @since 0.0.1
|
|
233
|
-
def subsets_groups
|
|
234
|
-
groups = {}
|
|
235
|
-
i18n_group = {}
|
|
236
|
-
|
|
237
|
-
subsets.each do |subset, options|
|
|
238
|
-
options[:group] = :default unless options[:group]
|
|
239
|
-
i18n_subset = self.human_attribute_name("subsets.#{subset}")
|
|
240
|
-
i18n_group[options[:group]] ||= self.human_attribute_name("subsets.#{options[:group]}")
|
|
241
|
-
groups[i18n_group[options[:group]]] ||= [options[:group], {}]
|
|
242
|
-
groups[i18n_group[options[:group]]].last[i18n_subset] = subset
|
|
243
|
-
end
|
|
244
|
-
|
|
245
|
-
# Rearrange groups
|
|
246
|
-
groups = groups.sort
|
|
247
|
-
groups.map do |group|
|
|
248
|
-
[group.last.first, group.first, group.last.last.sort]
|
|
249
|
-
end
|
|
250
|
-
end
|
|
251
|
-
|
|
252
229
|
# Return subsets included of a subsets scope
|
|
253
230
|
#
|
|
254
231
|
# @return [ Array ]
|
data/model_subsets.gemspec
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
|
2
|
-
require File.expand_path('../lib/model_subsets/version', __FILE__)
|
|
3
|
-
|
|
4
|
-
Gem::Specification.new do |gem|
|
|
5
|
-
gem.authors = ["Gauthier Delacroix"]
|
|
6
|
-
gem.email = ["gauthier.delacroix@gmail.com"]
|
|
7
|
-
gem.description = %q{ModelSubsets provides ability to split a single model into fields and properties subsets}
|
|
8
|
-
gem.summary = %q{Subsets management for Rails models}
|
|
9
|
-
gem.homepage = "https://github.com/porecreat/model_subsets"
|
|
10
|
-
|
|
11
|
-
gem.files = `git ls-files`.split($\)
|
|
12
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
13
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
14
|
-
gem.name = "model_subsets"
|
|
15
|
-
gem.require_paths = ["lib"]
|
|
16
|
-
gem.version = ModelSubsets::VERSION
|
|
17
|
-
|
|
18
|
-
gem.add_dependency("mongoid", ["~> 3.0.0"])
|
|
19
|
-
|
|
20
|
-
end
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
require File.expand_path('../lib/model_subsets/version', __FILE__)
|
|
3
|
+
|
|
4
|
+
Gem::Specification.new do |gem|
|
|
5
|
+
gem.authors = ["Gauthier Delacroix"]
|
|
6
|
+
gem.email = ["gauthier.delacroix@gmail.com"]
|
|
7
|
+
gem.description = %q{ModelSubsets provides ability to split a single model into fields and properties subsets}
|
|
8
|
+
gem.summary = %q{Subsets management for Rails models}
|
|
9
|
+
gem.homepage = "https://github.com/porecreat/model_subsets"
|
|
10
|
+
|
|
11
|
+
gem.files = `git ls-files`.split($\)
|
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
14
|
+
gem.name = "model_subsets"
|
|
15
|
+
gem.require_paths = ["lib"]
|
|
16
|
+
gem.version = ModelSubsets::VERSION
|
|
17
|
+
|
|
18
|
+
gem.add_dependency("mongoid", ["~> 3.0.0"])
|
|
19
|
+
|
|
20
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: model_subsets
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.11
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2013-04-09 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: mongoid
|
|
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
63
63
|
version: '0'
|
|
64
64
|
requirements: []
|
|
65
65
|
rubyforge_project:
|
|
66
|
-
rubygems_version: 1.8.
|
|
66
|
+
rubygems_version: 1.8.23
|
|
67
67
|
signing_key:
|
|
68
68
|
specification_version: 3
|
|
69
69
|
summary: Subsets management for Rails models
|