File tree Expand file tree Collapse file tree 2 files changed +39
-24
lines changed
tools/rail_inspector/lib/rail_inspector Expand file tree Collapse file tree 2 files changed +39
-24
lines changed Original file line number Diff line number Diff line change 3
3
require "pathname"
4
4
require_relative "./configuring/check/general_configuration"
5
5
require_relative "./configuring/check/framework_defaults"
6
+ require_relative "./configuring/document"
6
7
7
8
module RailInspector
8
9
class Configuring
@@ -43,29 +44,6 @@ def method_missing(name, ...)
43
44
end
44
45
end
45
46
46
- class Doc
47
- attr_accessor :general_config , :versioned_defaults
48
-
49
- def initialize ( content )
50
- @before , @versioned_defaults , @general_config , @after =
51
- content
52
- . split ( "\n " )
53
- . slice_before do |line |
54
- [
55
- "### Versioned Default Values" ,
56
- "### Rails General Configuration" ,
57
- "### Configuring Assets"
58
- ] . include? ( line )
59
- end
60
- . to_a
61
- end
62
-
63
- def to_s
64
- ( @before + @versioned_defaults + @general_config + @after ) . join ( "\n " ) +
65
- "\n "
66
- end
67
- end
68
-
69
47
attr_reader :errors , :files
70
48
71
49
def initialize ( rails_path )
@@ -88,7 +66,7 @@ def check
88
66
end
89
67
90
68
def doc
91
- @doc ||= Configuring ::Doc . new ( files . doc_path . read )
69
+ @doc ||= Configuring ::Document . parse ( files . doc_path . read )
92
70
end
93
71
94
72
def rails_version
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ module RailInspector
4
+ class Configuring
5
+ class Document
6
+ class << self
7
+ def parse ( text )
8
+ before , versioned_defaults , general_config , after =
9
+ text
10
+ . split ( "\n " )
11
+ . slice_before do |line |
12
+ [
13
+ "### Versioned Default Values" ,
14
+ "### Rails General Configuration" ,
15
+ "### Configuring Assets"
16
+ ] . include? ( line )
17
+ end
18
+ . to_a
19
+
20
+ new ( before , versioned_defaults , general_config , after )
21
+ end
22
+ end
23
+
24
+ attr_accessor :general_config , :versioned_defaults
25
+
26
+ def initialize ( before , versioned_defaults , general_config , after )
27
+ @before , @versioned_defaults , @general_config , @after =
28
+ before , versioned_defaults , general_config , after
29
+ end
30
+
31
+ def to_s
32
+ ( @before + @versioned_defaults + @general_config + @after ) . join ( "\n " ) +
33
+ "\n "
34
+ end
35
+ end
36
+ end
37
+ end
You can’t perform that action at this time.
0 commit comments