mix 0.0.1
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/lib/mix.rb +1 -0
- data/lib/mix/engine.rb +7 -0
- data/src/javascripts/mix.coffee +17 -0
- data/src/javascripts/mix.js +55 -0
- metadata +68 -0
data/lib/mix.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'mix/engine'
|
data/lib/mix/engine.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
Mix = (mixins...) ->
|
2
|
+
new Mixer(mixins)
|
3
|
+
|
4
|
+
class Mixer
|
5
|
+
constructor: (mixins) ->
|
6
|
+
@mixins = mixins
|
7
|
+
|
8
|
+
into: (objects...) ->
|
9
|
+
for mixin in @mixins
|
10
|
+
for name, method of mixin
|
11
|
+
for object in objects
|
12
|
+
object[name] = method
|
13
|
+
|
14
|
+
if module?
|
15
|
+
module.exports = Mix
|
16
|
+
else if window?
|
17
|
+
window.Mix = Mix
|
@@ -0,0 +1,55 @@
|
|
1
|
+
(function() {
|
2
|
+
var Mix, Mixer;
|
3
|
+
var __slice = Array.prototype.slice;
|
4
|
+
|
5
|
+
Mix = function() {
|
6
|
+
var mixins;
|
7
|
+
mixins = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
8
|
+
return new Mixer(mixins);
|
9
|
+
};
|
10
|
+
|
11
|
+
Mixer = (function() {
|
12
|
+
|
13
|
+
function Mixer(mixins) {
|
14
|
+
this.mixins = mixins;
|
15
|
+
}
|
16
|
+
|
17
|
+
Mixer.prototype.into = function() {
|
18
|
+
var method, mixin, name, object, objects, _i, _len, _ref, _results;
|
19
|
+
objects = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
20
|
+
_ref = this.mixins;
|
21
|
+
_results = [];
|
22
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
23
|
+
mixin = _ref[_i];
|
24
|
+
_results.push((function() {
|
25
|
+
var _results2;
|
26
|
+
_results2 = [];
|
27
|
+
for (name in mixin) {
|
28
|
+
method = mixin[name];
|
29
|
+
_results2.push((function() {
|
30
|
+
var _j, _len2, _results3;
|
31
|
+
_results3 = [];
|
32
|
+
for (_j = 0, _len2 = objects.length; _j < _len2; _j++) {
|
33
|
+
object = objects[_j];
|
34
|
+
_results3.push(object[name] = method);
|
35
|
+
}
|
36
|
+
return _results3;
|
37
|
+
})());
|
38
|
+
}
|
39
|
+
return _results2;
|
40
|
+
})());
|
41
|
+
}
|
42
|
+
return _results;
|
43
|
+
};
|
44
|
+
|
45
|
+
return Mixer;
|
46
|
+
|
47
|
+
})();
|
48
|
+
|
49
|
+
if (typeof module !== "undefined" && module !== null) {
|
50
|
+
module.exports = Mix;
|
51
|
+
} else if (typeof window !== "undefined" && window !== null) {
|
52
|
+
window.Mix = Mix;
|
53
|
+
}
|
54
|
+
|
55
|
+
}).call(this);
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mix
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Matt Parker
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-12-11 00:00:00 Z
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description: An engine that exposes a 'mix' asset to your Rails asset pipeline.
|
22
|
+
email: moonmaster9000@gmail.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files: []
|
28
|
+
|
29
|
+
files:
|
30
|
+
- lib/mix/engine.rb
|
31
|
+
- lib/mix.rb
|
32
|
+
- src/javascripts/mix.coffee
|
33
|
+
- src/javascripts/mix.js
|
34
|
+
homepage: http://github.com/moonmaster9000/mix.coffee
|
35
|
+
licenses: []
|
36
|
+
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options: []
|
39
|
+
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
hash: 3
|
48
|
+
segments:
|
49
|
+
- 0
|
50
|
+
version: "0"
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 3
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
version: "0"
|
60
|
+
requirements: []
|
61
|
+
|
62
|
+
rubyforge_project:
|
63
|
+
rubygems_version: 1.8.10
|
64
|
+
signing_key:
|
65
|
+
specification_version: 3
|
66
|
+
summary: Bringing 'extend'-like functionality to javascript.
|
67
|
+
test_files: []
|
68
|
+
|