prim 0.0.1 → 0.0.2
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/prim.gemspec +3 -3
- metadata +4 -5
- data/lib/prim/callbacks.rb +0 -30
data/prim.gemspec
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "prim"
|
3
|
-
s.version = "0.0.
|
3
|
+
s.version = "0.0.2"
|
4
4
|
s.date = "2012-12-19"
|
5
5
|
s.summary = "Easily manage Rails associations that need a primary member."
|
6
|
-
s.description = "Prim
|
7
|
-
Just add a short configuration to a model, generate and run a migration, and you're all set."
|
6
|
+
s.description = "With Prim it's easy to add a primary member to any one-to-many or many-to-many association. " +
|
7
|
+
"Just add a short configuration to a model, generate and run a migration, and you're all set."
|
8
8
|
s.authors = [ "Piers Mainwaring" ]
|
9
9
|
s.email = "piers@impossibly.org"
|
10
10
|
s.files = `git ls-files`.split("\n")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,16 +11,15 @@ bindir: bin
|
|
11
11
|
cert_chain: []
|
12
12
|
date: 2012-12-19 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
|
-
description:
|
15
|
-
|
16
|
-
|
14
|
+
description: With Prim it's easy to add a primary member to any one-to-many or many-to-many
|
15
|
+
association. Just add a short configuration to a model, generate and run a migration,
|
16
|
+
and you're all set.
|
17
17
|
email: piers@impossibly.org
|
18
18
|
executables: []
|
19
19
|
extensions: []
|
20
20
|
extra_rdoc_files: []
|
21
21
|
files:
|
22
22
|
- lib/prim.rb
|
23
|
-
- lib/prim/callbacks.rb
|
24
23
|
- lib/prim/collection.rb
|
25
24
|
- lib/prim/connector.rb
|
26
25
|
- lib/prim/helpers.rb
|
data/lib/prim/callbacks.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
module Prim
|
2
|
-
module Callbacks
|
3
|
-
def self.included(base)
|
4
|
-
base.send :extend, Defining
|
5
|
-
base.send :include, Running
|
6
|
-
end
|
7
|
-
|
8
|
-
module Defining
|
9
|
-
def define_prim_callbacks(*callbacks)
|
10
|
-
define_callbacks *[callbacks, { terminator: "result == false" }].flatten
|
11
|
-
callbacks.each do |callback|
|
12
|
-
eval <<-end_callbacks
|
13
|
-
def before_#{callback}(*args, &blk)
|
14
|
-
set_callback(:#{callback}, :before, *args, &blk)
|
15
|
-
end
|
16
|
-
def after_#{callback}(*args, &blk)
|
17
|
-
set_callback(:#{callback}, :after, *args, &blk)
|
18
|
-
end
|
19
|
-
end_callbacks
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
module Running
|
25
|
-
def run_prim_callbacks(callback, &block)
|
26
|
-
run_callbacks(callback, &block)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|