reselect-rails 2.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +40 -0
- data/Rakefile +10 -0
- data/app/assets/javascripts/reselect.js +135 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/reselect/rails.rb +13 -0
- data/lib/reselect/rails/version.rb +5 -0
- data/reselect-rails.gemspec +26 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8cd750ced077ab91446f0d43c53d432ab2c626db
|
4
|
+
data.tar.gz: 8dbe0f4a375a65debc0edba16780c6401d31da9c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3a011359c5c767d7f7a559e40b9a90e5677df11dd90ea1e7a99f0d7fc2bfd81bc095659df9321a4b20f63f9de2503eec52c4f0f33226d4ff280203f3b4d911dc
|
7
|
+
data.tar.gz: 862d06bf2aab20e387bd9fa4c5600149a8aa0b96bc99fe98f0e292e3ed9aa5324e0c5cb231f0551f8c527162739865deb1c2546a61ddd806db83291972fc81a5
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 ACT.md
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# Reselect::Rails
|
2
|
+
|
3
|
+
Rails wrapper for Reselect JavaScript library (https://github.com/reactjs/reselect). The version number of this gem follows the version number of the original JavaScript library.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'reselect-rails'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install reselect-rails
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Add the following code to ``application.js``:
|
24
|
+
```
|
25
|
+
//= reselect
|
26
|
+
```
|
27
|
+
|
28
|
+
## Development
|
29
|
+
|
30
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
31
|
+
|
32
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/actmd/reselect-rails.
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
if (typeof define === "function" && define.amd) {
|
3
|
+
define('Reselect', ['exports'], factory);
|
4
|
+
} else if (typeof exports !== "undefined") {
|
5
|
+
factory(exports);
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports);
|
11
|
+
global.Reselect = mod.exports;
|
12
|
+
}
|
13
|
+
})(this, function (exports) {
|
14
|
+
'use strict';
|
15
|
+
|
16
|
+
exports.__esModule = true;
|
17
|
+
exports.defaultMemoize = defaultMemoize;
|
18
|
+
exports.createSelectorCreator = createSelectorCreator;
|
19
|
+
exports.createStructuredSelector = createStructuredSelector;
|
20
|
+
|
21
|
+
function _toConsumableArray(arr) {
|
22
|
+
if (Array.isArray(arr)) {
|
23
|
+
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
|
24
|
+
arr2[i] = arr[i];
|
25
|
+
}
|
26
|
+
|
27
|
+
return arr2;
|
28
|
+
} else {
|
29
|
+
return Array.from(arr);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
function defaultEqualityCheck(a, b) {
|
34
|
+
return a === b;
|
35
|
+
}
|
36
|
+
|
37
|
+
function defaultMemoize(func) {
|
38
|
+
var equalityCheck = arguments.length <= 1 || arguments[1] === undefined ? defaultEqualityCheck : arguments[1];
|
39
|
+
|
40
|
+
var lastArgs = null;
|
41
|
+
var lastResult = null;
|
42
|
+
return function () {
|
43
|
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
44
|
+
args[_key] = arguments[_key];
|
45
|
+
}
|
46
|
+
|
47
|
+
if (lastArgs === null || lastArgs.length !== args.length || !args.every(function (value, index) {
|
48
|
+
return equalityCheck(value, lastArgs[index]);
|
49
|
+
})) {
|
50
|
+
lastResult = func.apply(undefined, args);
|
51
|
+
}
|
52
|
+
lastArgs = args;
|
53
|
+
return lastResult;
|
54
|
+
};
|
55
|
+
}
|
56
|
+
|
57
|
+
function getDependencies(funcs) {
|
58
|
+
var dependencies = Array.isArray(funcs[0]) ? funcs[0] : funcs;
|
59
|
+
|
60
|
+
if (!dependencies.every(function (dep) {
|
61
|
+
return typeof dep === 'function';
|
62
|
+
})) {
|
63
|
+
var dependencyTypes = dependencies.map(function (dep) {
|
64
|
+
return typeof dep;
|
65
|
+
}).join(', ');
|
66
|
+
throw new Error('Selector creators expect all input-selectors to be functions, ' + ('instead received the following types: [' + dependencyTypes + ']'));
|
67
|
+
}
|
68
|
+
|
69
|
+
return dependencies;
|
70
|
+
}
|
71
|
+
|
72
|
+
function createSelectorCreator(memoize) {
|
73
|
+
for (var _len2 = arguments.length, memoizeOptions = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
74
|
+
memoizeOptions[_key2 - 1] = arguments[_key2];
|
75
|
+
}
|
76
|
+
|
77
|
+
return function () {
|
78
|
+
for (var _len3 = arguments.length, funcs = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
79
|
+
funcs[_key3] = arguments[_key3];
|
80
|
+
}
|
81
|
+
|
82
|
+
var recomputations = 0;
|
83
|
+
var resultFunc = funcs.pop();
|
84
|
+
var dependencies = getDependencies(funcs);
|
85
|
+
|
86
|
+
var memoizedResultFunc = memoize.apply(undefined, [function () {
|
87
|
+
recomputations++;
|
88
|
+
return resultFunc.apply(undefined, arguments);
|
89
|
+
}].concat(memoizeOptions));
|
90
|
+
|
91
|
+
var selector = function selector(state, props) {
|
92
|
+
for (var _len4 = arguments.length, args = Array(_len4 > 2 ? _len4 - 2 : 0), _key4 = 2; _key4 < _len4; _key4++) {
|
93
|
+
args[_key4 - 2] = arguments[_key4];
|
94
|
+
}
|
95
|
+
|
96
|
+
var params = dependencies.map(function (dependency) {
|
97
|
+
return dependency.apply(undefined, [state, props].concat(args));
|
98
|
+
});
|
99
|
+
return memoizedResultFunc.apply(undefined, _toConsumableArray(params));
|
100
|
+
};
|
101
|
+
|
102
|
+
selector.resultFunc = resultFunc;
|
103
|
+
selector.recomputations = function () {
|
104
|
+
return recomputations;
|
105
|
+
};
|
106
|
+
selector.resetRecomputations = function () {
|
107
|
+
return recomputations = 0;
|
108
|
+
};
|
109
|
+
return selector;
|
110
|
+
};
|
111
|
+
}
|
112
|
+
|
113
|
+
var createSelector = exports.createSelector = createSelectorCreator(defaultMemoize);
|
114
|
+
|
115
|
+
function createStructuredSelector(selectors) {
|
116
|
+
var selectorCreator = arguments.length <= 1 || arguments[1] === undefined ? createSelector : arguments[1];
|
117
|
+
|
118
|
+
if (typeof selectors !== 'object') {
|
119
|
+
throw new Error('createStructuredSelector expects first argument to be an object ' + ('where each property is a selector, instead received a ' + typeof selectors));
|
120
|
+
}
|
121
|
+
var objectKeys = Object.keys(selectors);
|
122
|
+
return selectorCreator(objectKeys.map(function (key) {
|
123
|
+
return selectors[key];
|
124
|
+
}), function () {
|
125
|
+
for (var _len5 = arguments.length, values = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
126
|
+
values[_key5] = arguments[_key5];
|
127
|
+
}
|
128
|
+
|
129
|
+
return values.reduce(function (composition, value, index) {
|
130
|
+
composition[objectKeys[index]] = value;
|
131
|
+
return composition;
|
132
|
+
}, {});
|
133
|
+
});
|
134
|
+
}
|
135
|
+
});
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "reselect/rails"
|
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
|
data/bin/setup
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'reselect/rails/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "reselect-rails"
|
8
|
+
spec.version = Reselect::Rails::VERSION
|
9
|
+
spec.authors = ["Joon Lee"]
|
10
|
+
spec.email = ["joon@act.md"]
|
11
|
+
|
12
|
+
spec.summary = %q{Rails wrapper for Reselect JavaScript library}
|
13
|
+
spec.description = %q{Rails wrapper for Reselect JavaScript library (https://github.com/reactjs/reselect). The version number of this gem follows the version number of the original JavaScript library.}
|
14
|
+
spec.homepage = "https://github.com/actmd/reselect-rails"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.13"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: reselect-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.5.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Joon Lee
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-11-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.13'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.13'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
55
|
+
description: Rails wrapper for Reselect JavaScript library (https://github.com/reactjs/reselect).
|
56
|
+
The version number of this gem follows the version number of the original JavaScript
|
57
|
+
library.
|
58
|
+
email:
|
59
|
+
- joon@act.md
|
60
|
+
executables: []
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- ".gitignore"
|
65
|
+
- ".travis.yml"
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- app/assets/javascripts/reselect.js
|
71
|
+
- bin/console
|
72
|
+
- bin/setup
|
73
|
+
- lib/reselect/rails.rb
|
74
|
+
- lib/reselect/rails/version.rb
|
75
|
+
- reselect-rails.gemspec
|
76
|
+
homepage: https://github.com/actmd/reselect-rails
|
77
|
+
licenses: []
|
78
|
+
metadata: {}
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 2.6.8
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: Rails wrapper for Reselect JavaScript library
|
99
|
+
test_files: []
|