active_record_analyzer 0.2.0 → 0.2.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -4
- data/lib/active_record_analyzer.rb +2 -1
- data/lib/active_record_analyzer/attribute/belongs_to.rb +4 -4
- data/lib/active_record_analyzer/attribute/has_many.rb +5 -5
- data/lib/active_record_analyzer/attribute/simple.rb +4 -4
- data/lib/active_record_analyzer/version.rb +1 -1
- metadata +1 -2
- data/lib/active_record_analyzer/analyzer.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cb87531f6fe4fd2903fbbde1fcd4d7587a381d1
|
4
|
+
data.tar.gz: 6a4b0800a58a7345d238a59d731d48a7ef82137f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b380e755770840d7c88cbc1dd2abaaf13b3c59f79d762e709d4853a093faf3dce95e2f9d644d0e71aa182331e8b919f2da93017edabb6873310181a56d24bce
|
7
|
+
data.tar.gz: 541eed6f3d8004f6fa49e8f5587d87f3a2e7731eb10be62ecf2ea89fbcc126f99884c4af5bb24ba6b0f435d1753c91157c68d3c6b140a449719c9dd56812072a
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# ActiveRecordAnalyzer
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
**ActiveRecordAnalyzer** is a lib that gets you information about your ActiveRecord model attributes. You will be able to know whether an attribute is an association or not, and what kind of association.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -25,7 +23,7 @@ Or install it yourself as:
|
|
25
23
|
You can analyze your ActiveRecord model with the analyzer:
|
26
24
|
|
27
25
|
```ruby
|
28
|
-
analyzer = ActiveRecordAnalyzer::
|
26
|
+
analyzer = ActiveRecordAnalyzer::Reflector.new(User)
|
29
27
|
```
|
30
28
|
|
31
29
|
With the analyzer in place, given an attribute's name, you can get its type for the given class (`User` in the example):
|
@@ -1,11 +1,12 @@
|
|
1
1
|
require "active_record_analyzer/version"
|
2
2
|
require "active_record_analyzer/attribute"
|
3
3
|
require "active_record_analyzer/attribute/simple"
|
4
|
+
require "active_record_analyzer/attribute/has_many"
|
5
|
+
require "active_record_analyzer/attribute/belongs_to"
|
4
6
|
require "active_record_analyzer/reflector"
|
5
7
|
require "active_record_analyzer/reflector/belongs_to"
|
6
8
|
require "active_record_analyzer/reflector/has_many"
|
7
9
|
require "active_record_analyzer/reflector/simple"
|
8
|
-
require "active_record_analyzer/analyzer"
|
9
10
|
|
10
11
|
module ActiveRecordAnalyzer
|
11
12
|
end
|
@@ -1,17 +1,17 @@
|
|
1
1
|
class ActiveRecordAnalyzer::Attribute::BelongsTo
|
2
|
-
def association?
|
2
|
+
def self.association?
|
3
3
|
true
|
4
4
|
end
|
5
5
|
|
6
|
-
def simple_attribute?
|
6
|
+
def self.simple_attribute?
|
7
7
|
false
|
8
8
|
end
|
9
9
|
|
10
|
-
def has_many?
|
10
|
+
def self.has_many?
|
11
11
|
false
|
12
12
|
end
|
13
13
|
|
14
|
-
def one_to_many?
|
14
|
+
def self.one_to_many?
|
15
15
|
true
|
16
16
|
end
|
17
17
|
end
|
@@ -1,17 +1,17 @@
|
|
1
|
-
class ActiveRecordAnalyzer::Attribute::
|
2
|
-
def association?
|
1
|
+
class ActiveRecordAnalyzer::Attribute::HasMany
|
2
|
+
def self.association?
|
3
3
|
true
|
4
4
|
end
|
5
5
|
|
6
|
-
def simple_attribute?
|
6
|
+
def self.simple_attribute?
|
7
7
|
false
|
8
8
|
end
|
9
9
|
|
10
|
-
def has_many?
|
10
|
+
def self.has_many?
|
11
11
|
true
|
12
12
|
end
|
13
13
|
|
14
|
-
def one_to_many?
|
14
|
+
def self.one_to_many?
|
15
15
|
false
|
16
16
|
end
|
17
17
|
end
|
@@ -1,17 +1,17 @@
|
|
1
1
|
class ActiveRecordAnalyzer::Attribute::Simple
|
2
|
-
def association?
|
2
|
+
def self.association?
|
3
3
|
false
|
4
4
|
end
|
5
5
|
|
6
|
-
def simple_attribute?
|
6
|
+
def self.simple_attribute?
|
7
7
|
true
|
8
8
|
end
|
9
9
|
|
10
|
-
def has_many?
|
10
|
+
def self.has_many?
|
11
11
|
false
|
12
12
|
end
|
13
13
|
|
14
|
-
def one_to_many?
|
14
|
+
def self.one_to_many?
|
15
15
|
false
|
16
16
|
end
|
17
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_analyzer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ariel Scherman
|
@@ -114,7 +114,6 @@ files:
|
|
114
114
|
- bin/console
|
115
115
|
- bin/setup
|
116
116
|
- lib/active_record_analyzer.rb
|
117
|
-
- lib/active_record_analyzer/analyzer.rb
|
118
117
|
- lib/active_record_analyzer/attribute.rb
|
119
118
|
- lib/active_record_analyzer/attribute/belongs_to.rb
|
120
119
|
- lib/active_record_analyzer/attribute/has_many.rb
|