decode 0.14.0 → 0.14.1

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
  SHA256:
3
- metadata.gz: 3def34b952d9d52ecd46b00af1d0d6bf35c1e1356b73f0684044d374e23fcbf3
4
- data.tar.gz: b95a502a185aedaa5f64c6cdaee5abd30ba0739df530cc1fa5a957b54328f261
3
+ metadata.gz: b10527900f968f995dfb80150dbe8773f92857f190fe5ae3981af28363473530
4
+ data.tar.gz: c58a678e66c1416ebc3c7a19dae19789644c937e990343ec4ea3bc565ee991a7
5
5
  SHA512:
6
- metadata.gz: ebb0306d62ce7feeff715b4fb1f2b622d21ab877285c678e8a83acb08f2183c83c4bc6cf3f2ec88743006142fa9f1c8f1094812bf2fde96d1e6d2ffcdb65c133
7
- data.tar.gz: 79d583ef1946a0a94010fdd8b23cf2e36433e355eb7c6efb2f72bd949784b563d89e4693b73532e8fdc6cea3bef462dc6c74f484aff0cce95d289a675aebd731
6
+ metadata.gz: 2a5110378a537c6ee3ddb571a9d376af274e45ddf9835b347ac538a858eea5f140610e3cd04fa2e14c9c4c2e46a75f32adc7dbd10c39ac7de438ae2955336e7c
7
+ data.tar.gz: fd1b0e0bbc3912cd3eedfab8bf0b0e8c2bdcda930783f08305a7de9e92f2629e0b500f727dfd92a52958b283e429636ca8a3b83f1345de98bf59257bd17fc415
@@ -48,14 +48,6 @@ module Decode
48
48
  # The type of the attribute.
49
49
  # @attribute [String]
50
50
  attr :type
51
-
52
- # The details associated with the tag.
53
- # @attribute [String | Nil]
54
- attr :details
55
-
56
- def text
57
- text = super
58
- end
59
51
  end
60
52
  end
61
53
  end
@@ -63,11 +63,11 @@ module Decode
63
63
  end
64
64
 
65
65
  # Traverse the tags from this node using {each}.
66
- # Invoke `descend.call` to traverse the children of the current node.
66
+ # Invoke `descend.call(child)` to recursively traverse the specified child.
67
67
  #
68
- # @block {|node, descend| descend.call}
69
- # @yield node [Node] The current node which is being traversed.
70
- # @yield descend [Proc | Nil] The recursive method for traversing children.
68
+ # @yields {|node, descend| descend.call}
69
+ # @parameter node [Node] The current node which is being traversed.
70
+ # @parameter descend [Proc | Nil] The recursive method for traversing children.
71
71
  def traverse(&block)
72
72
  descend = ->(node){
73
73
  node.traverse(&block)
@@ -53,10 +53,6 @@ module Decode
53
53
  # The type of the attribute.
54
54
  # @attribute [String]
55
55
  attr :type
56
-
57
- # The details associated with the tag.
58
- # @attribute [String | Nil]
59
- attr :details
60
56
  end
61
57
  end
62
58
  end
@@ -44,12 +44,15 @@ module Decode
44
44
 
45
45
  # The symbol name.
46
46
  # e.g. `:Decode`.
47
+ # @attribute [Symbol]
47
48
  attr :name
48
49
 
49
- # The parent symbol, defining lexical scope.
50
+ # The parent definition, defining lexical scope.
51
+ # @attribute [Definition | Nil]
50
52
  attr :parent
51
53
 
52
54
  # The language the symbol is defined within.
55
+ # @attribute [Language::Generic]
53
56
  attr :language
54
57
 
55
58
  # The comment lines which directly preceeded the definition.
@@ -83,7 +86,8 @@ module Decode
83
86
  raise ArgumentError, "Unable to convert #{self} into #{kind}!"
84
87
  end
85
88
 
86
- # The lexical scope which is an array of lexical {Key} instances as generated by {key}.
89
+ # The lexical scope as an array of names.
90
+ # e.g. `[:Decode, :Definition]`
87
91
  # @returns [Array]
88
92
  def path
89
93
  if @path
@@ -49,7 +49,7 @@ module Decode
49
49
  attr :comments
50
50
 
51
51
  # The language in which the documentation was extracted from.
52
- # @attribute [Language]
52
+ # @attribute [Language::Generic]
53
53
  attr :language
54
54
  end
55
55
  end
@@ -45,6 +45,7 @@ module Decode
45
45
  attr :identifier
46
46
 
47
47
  # The language associated with this reference.
48
+ # @attribute [Language::Generic]
48
49
  attr :language
49
50
 
50
51
  # Whether the reference starts at the base of the lexical tree.
@@ -58,7 +58,7 @@ module Decode
58
58
 
59
59
  def convert(kind)
60
60
  case kind
61
- when :attr
61
+ when :attribute
62
62
  Attribute.new(@node, @name,
63
63
  comments: @comments, parent: @parent, language: @language
64
64
  )
@@ -52,9 +52,15 @@ module Decode
52
52
  end
53
53
  end
54
54
 
55
+ # The fully qualified name of the block.
56
+ # e.g. `::Barnyard#foo`.
57
+ def qualified_form
58
+ self.qualified_name
59
+ end
60
+
55
61
  def convert(kind)
56
62
  case kind
57
- when :attr
63
+ when :attribute
58
64
  Attribute.new(@node, @name,
59
65
  comments: @comments, parent: @parent, language: @language
60
66
  )
data/lib/decode/scope.rb CHANGED
@@ -23,10 +23,13 @@ require_relative 'definition'
23
23
  module Decode
24
24
  # An abstract namespace for nesting definitions.
25
25
  class Scope < Definition
26
+ # @returns [String] The name of the scope.
26
27
  def short_form
27
28
  @name
28
29
  end
29
30
 
31
+ # Scopes are always containers.
32
+ # @returns [Boolean] Always `true`.
30
33
  def container?
31
34
  true
32
35
  end
@@ -39,7 +39,7 @@ module Decode
39
39
  attr :comments
40
40
 
41
41
  # The language of the code attached to this segment.
42
- # @attribute [Language]
42
+ # @attribute [Language::Generic]
43
43
  attr :language
44
44
 
45
45
  # An interface for accsssing the documentation of the definition.
data/lib/decode/source.rb CHANGED
@@ -21,20 +21,32 @@
21
21
  require_relative 'language'
22
22
 
23
23
  module Decode
24
+ # Represents a source file in a specific language.
24
25
  class Source
25
26
  def initialize(path, language)
26
27
  @path = path
27
28
  @language = language
28
29
  end
29
30
 
31
+ # The path of the source file.
32
+ # @attribute [String] A file-system path.
30
33
  attr :path
31
34
 
35
+ # The language of the source file.
36
+ # @attribute [Language::Generic]
32
37
  attr :language
33
38
 
39
+ # Open the source file for reading.
40
+ # @yields {|file| ...} The opened {File} instance.
41
+ # @parameter file [File]
34
42
  def open(&block)
35
43
  File.open(@path, &block)
36
44
  end
37
45
 
46
+ # Open the source file and read all definitions.
47
+ # @yields {|definition| ...} All definitions from the source file.
48
+ # @parameter definition [Definition]
49
+ # @returns [Enumerator(Definition)] If no block given.
38
50
  def definitions(&block)
39
51
  return to_enum(:definitions) unless block_given?
40
52
 
@@ -43,6 +55,10 @@ module Decode
43
55
  end
44
56
  end
45
57
 
58
+ # Open the source file and read all segments.
59
+ # @yields {|segment| ...} All segments from the source file.
60
+ # @parameter segment [Segment]
61
+ # @returns [Enumerator(Segment)] If no block given.
46
62
  def segments(&block)
47
63
  return to_enum(:segments) unless block_given?
48
64
 
data/lib/decode/trie.rb CHANGED
@@ -116,7 +116,7 @@ module Decode
116
116
  end
117
117
 
118
118
  # Traverse the trie.
119
- # See {Node:traverse} for details.
119
+ # See {Node#traverse} for details.
120
120
  def traverse(path = [], &block)
121
121
  if node = @root.lookup(path)
122
122
  node.traverse(&block)
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Decode
22
- VERSION = "0.14.0"
22
+ VERSION = "0.14.1"
23
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams