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: d83d6f4f550c102c6a68ab8eb6940ac9985caacc
4
- data.tar.gz: 78cabc5fcaf7e7fc1deb86ed614a41933dbf5903
3
+ metadata.gz: 8b2d25865d4af4a7a7d2d8ae09344ac7b828148e
4
+ data.tar.gz: dc387ecfacf69092c3344fc5c1b4bfe7229087b0
5
5
  SHA512:
6
- metadata.gz: 7ad47baff71a66d2c059eb2034f71bb4a0fd4d31caa6b5961ec41203cb4c2bf565f16596477d5bb3be47f2f627ae80c3a6520890dcb3b00f251b8c36e3548f3d
7
- data.tar.gz: 57eded7a64cc79f1d81e3cd24a1583f984268ed5fa35d4883a5dbf19eae4e140dfdb5170689a9a1b7de5a48e70d0aa8b66e6e9f1ad555be8751ab454879c70a1
6
+ metadata.gz: 248469d48cdaf7dd7ffc82614a3e043ecde92ce800f5d64c271f8f268d0f5b20a7e7ee3f34a05a2a611cae3e5be128af02adc013490546343abe7dd5a4412c74
7
+ data.tar.gz: af2f65be144c7edc0367f8bde04e1bc97cacbe0afcf0947c1fbe62cb8bb14b2236b412e884b3442df133729884168a4be0a7881a65f03376db97d5791d86a6e7
@@ -1,6 +1,12 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+ ## 0.4.2
5
+
6
+ - The 'inspect' command now shows the original docstring provided by the
7
+ YARD object provider instead of parsing the string itself
8
+
9
+
4
10
  ## 0.4.1
5
11
 
6
12
  - Bugfix regarding @overload tags (thanks @cbeer)
@@ -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, '').dark
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
- @comments ||= code_object.files.map do |declaration|
153
- get_lines_up_while(declaration.filename, declaration.line_no - 1) do |line|
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
@@ -33,6 +33,7 @@ module Inch
33
33
  method?
34
34
  nodoc?
35
35
  namespace?
36
+ original_docstring
36
37
  overridden?
37
38
  overridden_method_fullname
38
39
  parameters
@@ -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?
@@ -161,6 +161,10 @@ module Inch
161
161
  self[:namespace?]
162
162
  end
163
163
 
164
+ def original_docstring
165
+ self[:original_docstring]
166
+ end
167
+
164
168
  # @return [Boolean] +true+ if the object was tagged not to be documented
165
169
  def nodoc?
166
170
  self[:nodoc?]
@@ -1,3 +1,3 @@
1
1
  module Inch
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
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.1
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-06 00:00:00.000000000 Z
11
+ date: 2014-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler