inch 0.5.7 → 0.5.8

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: 66c43ca8174a8055673d9e535152eb2e74fd7b45
4
- data.tar.gz: 703f6df47f294043330e98a63fcdb98f7194dcdd
3
+ metadata.gz: cd1b6ae7ca5ae4764816a45ac8aada91b776c622
4
+ data.tar.gz: b2f8b8c690f3ea84826bbfd45215542087ca545a
5
5
  SHA512:
6
- metadata.gz: fa6524451d1e4f9025b3838c76627d6f3e2dcb44df058238af3a09a378be973e385eb7f7b4f5593b8c92f2869ca2019ad3c42b90647f5a73560c80388dec8204
7
- data.tar.gz: d2c6c94f942e26c5d8a265ab68f30f2bb501f10007ad2467afd5ea83546859009c6dac6e045cc7043ee2c41b8b5a7f6f9632f88353ed084706f08b1437c023ed
6
+ metadata.gz: 511398f40a05ecf0f0ba776f81be7196ee28ada965b9a797f4c21c3a3a97cb16ba801de89c0de324d4f11974aadbd72897757c7c800e182ca5c87f470c8ed18a
7
+ data.tar.gz: 6e7273b119fe56d0e883cb11edf25a023677e95f6f73489c76341bea1d1bb1aa9f222374adb4fa14dfe6607b5c9ff13fb041884110fc73eac60dc7dca140c010
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.8
4
+
5
+ - Elixir: Recognize location (filename/line no.) of code objects
6
+
3
7
  ## 0.5.7
4
8
 
5
9
  - NodeJS: Add support for JSDoc's ClassObject
@@ -1,4 +1,5 @@
1
1
  require 'inch/language/elixir/provider/reader/docstring'
2
+ require 'inch/utils/code_location'
2
3
 
3
4
  module Inch
4
5
  module Language
@@ -22,11 +23,13 @@ module Inch
22
23
  end
23
24
 
24
25
  def files
25
- []
26
+ return [] if location.empty?
27
+ file, line_no = location[0], location[1]
28
+ [Inch::Utils::CodeLocation.new('', file, line_no)]
26
29
  end
27
30
 
28
31
  def filename
29
- nil
32
+ location[0]
30
33
  end
31
34
 
32
35
  attr_writer :children_fullnames
@@ -193,6 +196,12 @@ module Inch
193
196
  :public
194
197
  end
195
198
 
199
+ private
200
+
201
+ def location
202
+ @hash['source'].to_s.split(':')
203
+ end
204
+
196
205
  end
197
206
  end
198
207
  end
@@ -1,3 +1,3 @@
1
1
  module Inch
2
- VERSION = '0.5.7'
2
+ VERSION = '0.5.8'
3
3
  end
@@ -71,7 +71,7 @@
71
71
  "module": "Elixir.InchTest.Functions",
72
72
  "moduledoc": " In this module we define funs that are \"cases\" for our test suite.\n",
73
73
  "object_type": "ModuleObject",
74
- "source": null,
74
+ "source": "lib/inch_test/functions.ex:9",
75
75
  "type": null,
76
76
  "typespecs": []
77
77
  },
@@ -40,4 +40,17 @@ describe ::Inch::Language::Elixir::CodeObject::ModuleObject do
40
40
  assert m.nodoc?
41
41
  assert m.priority < 0
42
42
  end
43
+
44
+ it 'should recognize code location' do
45
+ m = @objects.find('InchTest.Functions')
46
+ file = m.filename
47
+ refute_nil file
48
+ assert_equal 'lib/inch_test/functions.ex', file.relative_path
49
+ assert_equal 9, file.line_no.to_i
50
+ end
51
+
52
+ it 'should recognize missing code location' do
53
+ m = @objects.find('InchTest.FunctionObject')
54
+ assert_nil m.filename
55
+ end
43
56
  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.5.7
4
+ version: 0.5.8
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-11-11 00:00:00.000000000 Z
11
+ date: 2014-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler