mcfly 0.0.16 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/mcfly/has_mcfly.rb +34 -2
- data/lib/mcfly/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13301c6e573ced175e281c52098e98647a6abfec
|
4
|
+
data.tar.gz: af09fa9778b5213f0b2f55250efd5c24ec466733
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7584d45565e2945d44456c3b15410ad37ac52f210a0a3ebb6e7841364dc70ec6bc64fb3cc32624b09f2f11f9cc17acf8225ce1d8f038c6c4c635c440e769e61b
|
7
|
+
data.tar.gz: 0301b2a811b417cf785f3d79f3ed52042f52bc22d3082c90d090d353cd19eab2f8d6f5241bf0ef22ba1edc7e87303187b492b7b376d88ea8c447d1f9125b4bf9
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mcfly (0.0.
|
4
|
+
mcfly (0.0.17)
|
5
5
|
delorean_lang (~> 0.1)
|
6
6
|
pg (~> 0.17)
|
7
7
|
|
@@ -82,7 +82,7 @@ GEM
|
|
82
82
|
tilt (~> 1.1, != 1.3.0)
|
83
83
|
thor (0.19.1)
|
84
84
|
tilt (1.4.1)
|
85
|
-
treetop (1.
|
85
|
+
treetop (1.6.2)
|
86
86
|
polyglot (~> 0.3)
|
87
87
|
tzinfo (0.3.43)
|
88
88
|
|
data/lib/mcfly/has_mcfly.rb
CHANGED
@@ -1,7 +1,17 @@
|
|
1
1
|
require 'delorean_lang'
|
2
2
|
|
3
3
|
module Mcfly
|
4
|
-
INFINITIES = Set[Float::INFINITY, 'infinity', 'Infinity']
|
4
|
+
INFINITIES = Set[Float::INFINITY, 'infinity', 'Infinity'].freeze
|
5
|
+
|
6
|
+
# Mcfly special columns -- FIXME: should "id" be here?
|
7
|
+
COLUMNS = Set[
|
8
|
+
"id",
|
9
|
+
"group_id",
|
10
|
+
"user_id",
|
11
|
+
"created_dt",
|
12
|
+
"obsoleted_dt",
|
13
|
+
"o_user_id",
|
14
|
+
].freeze
|
5
15
|
|
6
16
|
def self.is_infinity(pt)
|
7
17
|
Mcfly::INFINITIES.member? pt
|
@@ -11,6 +21,17 @@ module Mcfly
|
|
11
21
|
Mcfly::INFINITIES.member?(pt) ? 'infinity' : pt
|
12
22
|
end
|
13
23
|
|
24
|
+
def self.has_mcfly?(klass)
|
25
|
+
# check if a class is mcfly enabled -- FIXME: currently this is
|
26
|
+
# checked using MCFLY_UNIQUENESS which is somewhat hacky.
|
27
|
+
klass.const_defined? :MCFLY_UNIQUENESS
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.mcfly_uniqueness(klass)
|
31
|
+
# return uniqueness keys
|
32
|
+
klass.const_get :MCFLY_UNIQUENESS
|
33
|
+
end
|
34
|
+
|
14
35
|
module Model
|
15
36
|
class AssociationValidator < ActiveModel::Validator
|
16
37
|
VALSET = Set[nil, Float::INFINITY, 'infinity']
|
@@ -61,12 +82,23 @@ module Mcfly
|
|
61
82
|
end
|
62
83
|
|
63
84
|
def mcfly_validates_uniqueness_of(*attr_names)
|
85
|
+
# FIXME: this all looks somewhat hacky since it makes
|
86
|
+
# assumptions about the shape of attr_names. Should, at
|
87
|
+
# least, add some assertions here to check the assumptions.
|
88
|
+
|
64
89
|
# Set MCFLY_UNIQUENESS class constant to the args passed.
|
65
90
|
# This is useful for introspection. FIXME: won't work if
|
66
91
|
# mcfly_validates_uniqueness_of is called multiple times on
|
67
92
|
# the same class.
|
68
|
-
|
93
|
+
attr_list =
|
94
|
+
if attr_names.last.is_a?(Hash)
|
95
|
+
attr_names[0..-2] + (attr_names.last[:scope] || [])
|
96
|
+
else
|
97
|
+
attr_names.clone
|
98
|
+
end
|
99
|
+
self.const_set(:MCFLY_UNIQUENESS, attr_list.freeze)
|
69
100
|
|
101
|
+
# start building arguments to validates_uniqueness_of
|
70
102
|
attr_names << {} unless attr_names.last.is_a?(Hash)
|
71
103
|
|
72
104
|
attr_names.last[:scope] ||= []
|
data/lib/mcfly/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mcfly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arman Bostani
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|