mcfly 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitignore +1 -0
- data/lib/mcfly.rb +1 -2
- data/lib/mcfly/has_mcfly.rb +13 -6
- data/lib/mcfly/version.rb +1 -1
- data/spec/dummy/config/application.rb +2 -0
- data/spec/dummy/config/{database.yml → database.yml.example} +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Yzk5MzU3ZDk0ZDQxNzNkNDhkOTJkOTM2MzVlN2I0ODJhNGJmZmI1Mw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MTYwMTFmODFlMWJkZTdiMDc1NjBhODkwNGQyOGFiMzNiODJiYTlkNA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWIyNTFiOTY1OTNlMjYwNzFlOWIxNTM3ZWEzMTkzYzg0NGNmY2FlNzFkZjI3
|
10
|
+
MTlmZWZmZGQ3MTcyMmRhOGY0Y2JmMjQ0NWI2MDk3Y2U5NmFjY2VjNjk3ZmEz
|
11
|
+
NjRmNmRmMzZhNTRlYWM3YjlmZTRmYjg3MTRiMDk2MWNjYWFiNjI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
N2U5YTkwNjUwNjg1YzI1ZmU1MTg4MGE2ZmM1MDExMGFkNTEyNDU2ZGY0MTI2
|
14
|
+
MzYxNzc0ZWNjNDg1NzNjYmE3YzhiOTZkYTVkMTEzM2ViMzc3OWVkMTU0M2Rj
|
15
|
+
Yjg1MmIxMGZiYTYxMDQzMjM3MjFiN2YyZjc1OTY1YjhjMmIyYmQ=
|
data/.gitignore
CHANGED
data/lib/mcfly.rb
CHANGED
data/lib/mcfly/has_mcfly.rb
CHANGED
@@ -1,9 +1,17 @@
|
|
1
1
|
require 'delorean_lang'
|
2
2
|
|
3
3
|
module Mcfly
|
4
|
-
|
5
|
-
|
4
|
+
INFINITIES = Set[Float::INFINITY, 'infinity', 'Infinity']
|
5
|
+
|
6
|
+
def self.is_infinity(pt)
|
7
|
+
Mcfly::INFINITIES.member? pt
|
8
|
+
end
|
6
9
|
|
10
|
+
def self.normalize_infinity(pt)
|
11
|
+
Mcfly::INFINITIES.member?(pt) ? 'infinity' : pt
|
12
|
+
end
|
13
|
+
|
14
|
+
module Model
|
7
15
|
class AssociationValidator < ActiveModel::Validator
|
8
16
|
VALSET = Set[nil, Float::INFINITY, 'infinity']
|
9
17
|
|
@@ -43,8 +51,7 @@ module Mcfly
|
|
43
51
|
delorean_fn(name, options) do |ts, *args|
|
44
52
|
raise "time cannot be nil" if ts.nil?
|
45
53
|
|
46
|
-
|
47
|
-
ts = 'infinity' if Mcfly::Model::INFINITIES.member? ts
|
54
|
+
ts = Mcfly.normalize_infinity(ts)
|
48
55
|
|
49
56
|
self.where("#{table_name}.obsoleted_dt >= ? AND " +
|
50
57
|
"#{table_name}.created_dt < ?", ts, ts).scoping do
|
@@ -98,7 +105,7 @@ module Mcfly
|
|
98
105
|
module InstanceMethods
|
99
106
|
def record_validation
|
100
107
|
if self.changed?
|
101
|
-
self.user_id = Mcfly.whodunnit
|
108
|
+
self.user_id = Mcfly.whodunnit[:id] rescue nil
|
102
109
|
self.obsoleted_dt ||= 'infinity'
|
103
110
|
end
|
104
111
|
end
|
@@ -107,7 +114,7 @@ module Mcfly
|
|
107
114
|
# checks against registered associations
|
108
115
|
if self.class.class_variable_defined?(:@@associations)
|
109
116
|
self.class.class_variable_get(:@@associations).each do |klass, fk|
|
110
|
-
self.errors.add :base,
|
117
|
+
self.errors.add :base,
|
111
118
|
"#{self.class.name.demodulize} can't be deleted " +
|
112
119
|
"because #{klass.name.demodulize} records exist" if
|
113
120
|
klass.where("obsoleted_dt = ? AND #{fk} = ?",
|
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.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arman Bostani
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -120,7 +120,7 @@ files:
|
|
120
120
|
- spec/dummy/config.ru
|
121
121
|
- spec/dummy/config/application.rb
|
122
122
|
- spec/dummy/config/boot.rb
|
123
|
-
- spec/dummy/config/database.yml
|
123
|
+
- spec/dummy/config/database.yml.example
|
124
124
|
- spec/dummy/config/environment.rb
|
125
125
|
- spec/dummy/config/environments/development.rb
|
126
126
|
- spec/dummy/config/environments/production.rb
|