rubocop-rails-order_model_declarative_methods 0.2.0 → 0.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 90cea283bc1923364c8e858ed0598fbb2e48333f
4
- data.tar.gz: 80de6633fd811cc3750aa619efbf88844ecd30ba
3
+ metadata.gz: a84c4a1c264ea7744047c1ea5040422d705e5824
4
+ data.tar.gz: 48b9b7cc6a7e4c5fbc5fda6764b28d43c3ac77cd
5
5
  SHA512:
6
- metadata.gz: 3276e9fc0fb9a493ff833bc528fd264bf99a884b3a749344c4b69b89620ec263b3bca8628dddc270f899a565c230d29d1c04114fc2bbd4c3415aad0784b38850
7
- data.tar.gz: 50e69660e618da36e8c63966311db7c573b5f4f446560e896db3cbd28a513bc8bb6d600c5136d82bd2910f5378a604c5e9b768425a8ea9e63628ec7f67c10de0
6
+ metadata.gz: 1b4d3005fee348ebc37345b7a3862d667e1f5604d9f1baea42b392de5b8659112e738dd0edca39239405babcc2f0f0fc7951450d840a0cbfbf08a9bc5b7bc984
7
+ data.tar.gz: 7061834b8255f32c9dabbc76a5a7d15711379c376d6b34733d1a90bc93e3ff994b1468ed03b20e0f9db221d2ba779f3d1386800965b63ba137a1f8c4e2cb4580
data/README.md CHANGED
@@ -99,8 +99,12 @@ end
99
99
  5. Create new Pull Request
100
100
 
101
101
 
102
- License
103
- -------
102
+ ## Links
103
+
104
+ - [Rails のモデル内のメソッドをソートするRubocop Extension を作った - pockestrap](http://pocke.hatenablog.com/entry/2016/03/04/232425) (Japanese Blog)
105
+
106
+
107
+ ## License
104
108
 
105
109
  These codes are licensed under CC0.
106
110
 
@@ -1,5 +1,5 @@
1
1
  Rails/OrderModelDeclarativeMethods:
2
- Description: 'TODO'
2
+ Description: 'Sort declarative methods of Rails model'
3
3
  Enabled: true
4
4
  Include:
5
5
  - app/models/**/*.rb
@@ -49,14 +49,14 @@ module RuboCop
49
49
  return unless body.begin_type?
50
50
 
51
51
  targets = target_methods(body)
52
- return if targets == sort_callbacks(targets)
52
+ return if targets == sort_methods(targets)
53
53
 
54
54
  add_offense(body, :expression)
55
55
  end
56
56
 
57
57
  def autocorrect(body)
58
58
  targets = target_methods(body)
59
- sorteds = sort_callbacks(targets)
59
+ sorteds = sort_methods(targets)
60
60
  sorteds.push(nil)
61
61
 
62
62
  lambda do |corrector|
@@ -101,7 +101,7 @@ module RuboCop
101
101
  end
102
102
 
103
103
  # TODO: Rename
104
- def sort_callbacks(callbacks)
104
+ def sort_methods(callbacks)
105
105
  i = 0
106
106
  callbacks.sort_by{|x| [target_method_names.find_index(x.method_name), i+=1]}
107
107
  end
@@ -1,7 +1,7 @@
1
1
  module Rubocop
2
2
  module Rails
3
3
  module OrderModelDeclarativeMethods
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-rails-order_model_declarative_methods
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masataka Kuwabara
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-04 00:00:00.000000000 Z
11
+ date: 2016-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop