inch 0.4.1 → 0.4.2
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8b2d25865d4af4a7a7d2d8ae09344ac7b828148e
|
|
4
|
+
data.tar.gz: dc387ecfacf69092c3344fc5c1b4bfe7229087b0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 248469d48cdaf7dd7ffc82614a3e043ecde92ce800f5d64c271f8f268d0f5b20a7e7ee3f34a05a2a611cae3e5be128af02adc013490546343abe7dd5a4412c74
|
|
7
|
+
data.tar.gz: af2f65be144c7edc0367f8bde04e1bc97cacbe0afcf0947c1fbe62cb8bb14b2236b412e884b3442df133729884168a4be0a7881a65f03376db97d5791d86a6e7
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,7 @@ module Inch
|
|
|
7
7
|
|
|
8
8
|
COLOR = :color198 # magenta-ish
|
|
9
9
|
BG_COLOR = :color207 # magenta-ish
|
|
10
|
+
COMMENT_COLOR = :dark
|
|
10
11
|
LJUST = 20
|
|
11
12
|
|
|
12
13
|
def initialize(options, objects)
|
|
@@ -47,7 +48,7 @@ module Inch
|
|
|
47
48
|
def print_code_info(o)
|
|
48
49
|
if o.method?
|
|
49
50
|
CommentAndAbbrevSource.new(o).lines.each do |line|
|
|
50
|
-
echo line.gsub(/\n$/m, '').
|
|
51
|
+
echo line.gsub(/\n$/m, '').color(COMMENT_COLOR)
|
|
51
52
|
end
|
|
52
53
|
echo separator
|
|
53
54
|
end
|
|
@@ -149,35 +150,10 @@ module Inch
|
|
|
149
150
|
end
|
|
150
151
|
|
|
151
152
|
def comments
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
line =~ /^\s*#/
|
|
155
|
-
end.flatten.join('')
|
|
153
|
+
code_object.original_docstring.lines.map do |line|
|
|
154
|
+
"# #{line}"
|
|
156
155
|
end
|
|
157
156
|
end
|
|
158
|
-
|
|
159
|
-
def get_lines_up_while(filename, line_no, &block)
|
|
160
|
-
lines = []
|
|
161
|
-
line = get_line_no(filename, line_no)
|
|
162
|
-
if yield(line) && line_no > 0
|
|
163
|
-
lines << line.gsub(/^(\s+)/, '')
|
|
164
|
-
lines << get_lines_up_while(filename, line_no - 1, &block)
|
|
165
|
-
end
|
|
166
|
-
lines.reverse
|
|
167
|
-
end
|
|
168
|
-
|
|
169
|
-
# Returns a +line_number+ from a file
|
|
170
|
-
#
|
|
171
|
-
# @param filename [String]
|
|
172
|
-
# @param line_number [Fixnum]
|
|
173
|
-
# @return [String]
|
|
174
|
-
def get_line_no(filename, line_number)
|
|
175
|
-
f = File.open(filename)
|
|
176
|
-
line_number.times{f.gets}
|
|
177
|
-
result = $_
|
|
178
|
-
f.close
|
|
179
|
-
result
|
|
180
|
-
end
|
|
181
157
|
end
|
|
182
158
|
end
|
|
183
159
|
end
|
|
@@ -175,6 +175,11 @@ module Inch
|
|
|
175
175
|
false
|
|
176
176
|
end
|
|
177
177
|
|
|
178
|
+
# @return [String] the documentation comments
|
|
179
|
+
def original_docstring
|
|
180
|
+
object.docstring.all.to_s
|
|
181
|
+
end
|
|
182
|
+
|
|
178
183
|
def parameters
|
|
179
184
|
[]
|
|
180
185
|
end
|
|
@@ -231,11 +236,6 @@ module Inch
|
|
|
231
236
|
text.scan(/\b(#{Regexp.escape(name)})[^_0-9\!\?]/m).size > 1
|
|
232
237
|
end
|
|
233
238
|
|
|
234
|
-
# @return [String] the documentation comments
|
|
235
|
-
def original_docstring
|
|
236
|
-
object.docstring.all.to_s
|
|
237
|
-
end
|
|
238
|
-
|
|
239
239
|
# @return [Boolean]
|
|
240
240
|
# +true+ if the object or its parent is tagged as @private
|
|
241
241
|
def private_tag?
|
data/lib/inch/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: inch
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- René Föhring
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-04-
|
|
11
|
+
date: 2014-04-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|