active_record_analyzer 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c0dd5291013bb06400e6ad9fbd0f67f6caef9248
4
- data.tar.gz: c5cd455a34119a916e5742e7d86b9d66d83ae16d
3
+ metadata.gz: 0cb87531f6fe4fd2903fbbde1fcd4d7587a381d1
4
+ data.tar.gz: 6a4b0800a58a7345d238a59d731d48a7ef82137f
5
5
  SHA512:
6
- metadata.gz: ad85a3d38216069edfaf2d668fd1cc55541e244977b1361902a6a44a291b25dba418801d8f2a3d0f107110c947b6d12a671048b52c348e38c81d8eb0721a246b
7
- data.tar.gz: 77da4f15e4e94be3ec84ac26b8977946145d367f4a4384b58063381784e41a524ccb5b10920aa9cb3effd5660c37cc1e018aab8216973ecdb4ae0aa83ac49f6a
6
+ metadata.gz: 6b380e755770840d7c88cbc1dd2abaaf13b3c59f79d762e709d4853a093faf3dce95e2f9d644d0e71aa182331e8b919f2da93017edabb6873310181a56d24bce
7
+ data.tar.gz: 541eed6f3d8004f6fa49e8f5587d87f3a2e7731eb10be62ecf2ea89fbcc126f99884c4af5bb24ba6b0f435d1753c91157c68d3c6b140a449719c9dd56812072a
@@ -1,5 +1,9 @@
1
1
  # ChangeLog
2
2
 
3
+ ## 0.2.1 (2018-02-25)
4
+
5
+ - Change API from `Analyzer` to `Reflector`.
6
+
3
7
  ## 0.2.0 (2018-02-25)
4
8
 
5
9
  - Add specific associations reflections (has_many and belongs_to).
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # ActiveRecordAnalyzer
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/active_record_analyzer`. To experiment with that code, run `bin/console` for an interactive prompt.
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::Analyzer.new(User)
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::BelongsTo
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
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordAnalyzer
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  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.0
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
@@ -1,5 +0,0 @@
1
- class ActiveRecordAnalyzer::Analyzer
2
- def initialize(klass)
3
- ActiveRecordAnalyzer::Reflector.new(klass)
4
- end
5
- end