ssource 0.1.0 → 0.1.1
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: d4c72c5b5334c98667260a99921f8a99f37d5270
|
4
|
+
data.tar.gz: d6b4d21fa6c804d11d2c4836752a46ff1981befc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15f87ac2eb0c7fac01e6ff06afb8e3b96e8259b175731f4781a53f572165394688b01a2ac2a6d5d67050a981f7216568d90dbb34418dd2d70c2f38f88efdd377
|
7
|
+
data.tar.gz: 171ff8f43c7a37873b34ce19105647b772c5b0aa8a3883522bcfd0388037f1d4503725d1d719756a7d43c77d2f0677e147095d179cc624ef47abfeb3aebeb4a9
|
data/lib/ssource/source.rb
CHANGED
@@ -2,11 +2,21 @@ module Ssource
|
|
2
2
|
module Source
|
3
3
|
class Element
|
4
4
|
attr_reader :name, :kind, :accessibility, :elements
|
5
|
+
|
6
|
+
attr_reader :offset, :length, :name_offset, :name_length, :body_offset, :body_length
|
7
|
+
|
5
8
|
def initialize(json)
|
6
9
|
@name = json['name']
|
7
10
|
@accessibility = json['accessibility']
|
8
11
|
@kind = json['kind']
|
9
12
|
|
13
|
+
@offset = json['offset']
|
14
|
+
@length = json['length']
|
15
|
+
@name_offset = json['nameoffset']
|
16
|
+
@name_length = json['namelength']
|
17
|
+
@body_offset = json['bodyoffset']
|
18
|
+
@body_length = json['bodylength']
|
19
|
+
|
10
20
|
@elements = json.fetch('substructure', []).reduce([]) do |arr, structure|
|
11
21
|
arr << Factory.build(structure)
|
12
22
|
end
|
@@ -21,7 +31,7 @@ module Ssource
|
|
21
31
|
end
|
22
32
|
|
23
33
|
def pretty_print
|
24
|
-
|
34
|
+
display_name
|
25
35
|
end
|
26
36
|
end
|
27
37
|
end
|
data/lib/ssource/source/klass.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
require_relative 'element'
|
2
3
|
require_relative 'method'
|
3
4
|
require_relative 'variable'
|
@@ -5,8 +6,14 @@ require_relative 'variable'
|
|
5
6
|
module Ssource
|
6
7
|
module Source
|
7
8
|
class Klass < Element
|
9
|
+
attr_reader :superklass
|
10
|
+
attr_reader :protocols
|
11
|
+
|
8
12
|
def initialize(json)
|
9
13
|
super
|
14
|
+
inherited_types = json.fetch('inheritedtypes', []).map { |hash| hash['key.name'] }
|
15
|
+
@superklass = inherited_types.first
|
16
|
+
@protocols = inherited_types[1..-1] || []
|
10
17
|
end
|
11
18
|
|
12
19
|
def methods
|
@@ -37,9 +44,9 @@ module Ssource
|
|
37
44
|
end
|
38
45
|
|
39
46
|
def pretty_print
|
40
|
-
result = elements_variables.each_with_object(
|
47
|
+
result = elements_variables.each_with_object({}) do |method, hash|
|
41
48
|
collections = send(method).map(&:pretty_print)
|
42
|
-
hash[
|
49
|
+
hash[method.to_s.capitalize] = collections unless collections.empty?
|
43
50
|
end
|
44
51
|
{ display_name => result }
|
45
52
|
end
|
data/lib/ssource/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ssource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- draveness
|
@@ -120,7 +120,7 @@ files:
|
|
120
120
|
- lib/ssource/source/factory.rb
|
121
121
|
- lib/ssource/source/klass.rb
|
122
122
|
- lib/ssource/source/method.rb
|
123
|
-
- lib/ssource/source/
|
123
|
+
- lib/ssource/source/root_object.rb
|
124
124
|
- lib/ssource/source/variable.rb
|
125
125
|
- lib/ssource/source_kitten.rb
|
126
126
|
- lib/ssource/version.rb
|