blufin-lib 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c18b8e80ef480a5dad4b4ce1d23d8c357ef41144
4
- data.tar.gz: 3ac8da0829f69021888397ad1c8879d3ae7f48e2
3
+ metadata.gz: b67f2cab38a86d25509d04a27f4a29646951c644
4
+ data.tar.gz: 520e83c0929b0652df8fe8eb7a4d78afff27249e
5
5
  SHA512:
6
- metadata.gz: f3527a65e1fba07c5915007e4b2925e01bf183eecbbde9e8087e99bf8ac43bf731b1a50577d589828c21220942e9dd6f9c8b13aeab95af1a06b5777ff4eec357
7
- data.tar.gz: 743bba3db7bcc1cd51c4cd43b14fe94e55394e60b7586b6959c2766804043800c5f76ced3cc5fb987198cf57dfb0565cb2c90f3e3a4a9a87750fe994a6e5f9f8
6
+ metadata.gz: a0c9ba5176bd5f873d969296d303ea96f171cb4a48a02c4720d23f9d9141a77777a32af483a196a72c7e40e4838c6b0684b29860c5e7fdecbe9c20879e8624a4
7
+ data.tar.gz: 2745fab81a44b885f73c1961d73fa7a7cd68943bef5e2d2a2a44b518fa407140d87986a3d6c0bb0596ebad10062b03d40bd1e6764a4f68431b37103231983ff3
@@ -11,6 +11,7 @@ module Blufin
11
11
  # Check path exists.
12
12
  Blufin::Terminal::error("Path does not exist: #{Blufin::Terminal::format_invalid(path)}") unless Blufin::Files::path_exists(path)
13
13
 
14
+ @path = path
14
15
  @data = {}
15
16
  @errors = []
16
17
 
@@ -27,9 +28,11 @@ module Blufin
27
28
  # @return void
28
29
  def self.scan_file(file)
29
30
 
30
- @file = file
31
- @data[@file] = {}
32
- @data[@file][:methods] = {}
31
+ @file = file
32
+ @file_short = Blufin::Strings::remove_surrounding_slashes(file.gsub(@path, ''))
33
+ @data[@file_short] = {}
34
+ @data[@file_short][:methods] = {}
35
+ @data[@file_short][:file] = file
33
36
 
34
37
  @line = nil
35
38
  @line_number = 0
@@ -120,6 +123,8 @@ module Blufin
120
123
  ls = line.gsub(/^\s*\*+\s*@returns\s+/, '').split(' ')
121
124
  @docs[:return] = nil
122
125
  @docs[:return] = extract_type(ls[0], true) if ls.any?
126
+ elsif line.strip == '*'
127
+ return
123
128
  else
124
129
  raise RuntimeError, 'Something is wrong with this line, it failed to parse.'
125
130
  end
@@ -130,7 +135,7 @@ module Blufin
130
135
  def self.parse_method_definition(line)
131
136
  method_name = line.strip.gsub(/\(.*$/, '')
132
137
  method_private = method_name =~ /^_/ ? true : false
133
- raise RuntimeError, "Duplicate method: #{method_name}" if @data[@file][:methods].keys.include?(method_name)
138
+ raise RuntimeError, "Duplicate method: #{method_name}" if @data[@file_short][:methods].keys.include?(method_name)
134
139
  matches = line.match(/\(.*\)/)
135
140
  raise RuntimeError, 'Unable to extract method parameters.' unless matches.length == 1
136
141
  params = matches[0].strip.gsub(/^\(/, '').gsub(/\)$/, '')
@@ -142,7 +147,7 @@ module Blufin
142
147
  raise RuntimeError, "Expected exactly one equal (=) sign, got: #{ps.length - 1}" unless ps.length == 2
143
148
  param_extracted = ps[0].strip
144
149
  raise RuntimeError, "Duplicate parameter: #{param_extracted}" if @params.has_key?(param_extracted)
145
- @params[param_extracted] = {:default => ps[1].strip}
150
+ @params[param_extracted] = { :default => ps[1].strip }
146
151
  elsif param =~ /\w+/
147
152
  raise RuntimeError, "Duplicate parameter: #{param}" if @params.has_key?(param)
148
153
  @params[param] = {}
@@ -150,9 +155,9 @@ module Blufin
150
155
  raise RuntimeError, "Unrecognized parameter: #{param}"
151
156
  end
152
157
  end
153
- @docs = {:params => {}} unless @docs.is_a?(Hash)
154
- @docs[:params] = {} unless @docs[:params].is_a?(Hash)
155
- @data[@file][:methods][method_name] = {
158
+ @docs = { :params => {} } unless @docs.is_a?(Hash)
159
+ @docs[:params] = {} unless @docs[:params].is_a?(Hash)
160
+ @data[@file_short][:methods][method_name] = {
156
161
  :line => @line,
157
162
  :line_number => @line_number,
158
163
  :docs => @docs,
data/lib/version.rb CHANGED
@@ -1 +1 @@
1
- BLUFIN_LIB_VERSION = '2.0.0'
1
+ BLUFIN_LIB_VERSION = '2.1.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blufin-lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Albert Rannetsperger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-17 00:00:00.000000000 Z
11
+ date: 2020-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: highline