trees 0.3.0 → 0.3.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 +4 -4
- data/lib/line.rb +0 -2
- data/lib/trees.rb +8 -2
- data/lib/trie_node.rb +1 -2
- data/lib/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f28157a8f81da196dc69c9b0d69f27bfb42dcfcd6014f1f70fc37ec5dbc08902
|
|
4
|
+
data.tar.gz: cc552a494d2c6f3375c1d3116259e32450d5e6148206ab136a2a4e4329ff5068
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 48b6074a89b316d1b0ba6b78c23b90ac59d80007e409d30c37cfc6ea62b5262c42aadbc275d5c024a4908c446344a77a8429902525e9c071d0bac080288938b1
|
|
7
|
+
data.tar.gz: ddb78fe510d654e9e15c32d4146bd93d8291817870ae3d8d56743c521d8cd0afb276668dbd2798c4ceaf0071cf83d556eac1e6da56d1d55f104504445c5f14e8
|
data/lib/line.rb
CHANGED
data/lib/trees.rb
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'lowtype'
|
|
4
|
+
|
|
3
5
|
require_relative 'line'
|
|
4
6
|
require_relative 'trie'
|
|
5
7
|
|
|
6
8
|
module Trees
|
|
7
9
|
attr_reader :lines, :trie
|
|
8
10
|
|
|
11
|
+
TOKEN_SEPARATOR = ' '.freeze
|
|
12
|
+
|
|
9
13
|
def line(path, &block)
|
|
10
14
|
current_path << path
|
|
11
|
-
|
|
15
|
+
current_path_joined = current_path.join(TOKEN_SEPARATOR)
|
|
16
|
+
|
|
17
|
+
@current_line = Line.new(path: current_path_joined, params: block.parameters.to_h)
|
|
12
18
|
|
|
13
|
-
lines[
|
|
19
|
+
lines[current_path_joined] = @current_line
|
|
14
20
|
trie.merge(line: @current_line)
|
|
15
21
|
|
|
16
22
|
block.call if block_given?
|
data/lib/trie_node.rb
CHANGED
|
@@ -7,8 +7,7 @@ module Trees
|
|
|
7
7
|
include LowType
|
|
8
8
|
using LowType::Syntax
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
type_reader nodes: Hash[String => TrieNode] | Hash
|
|
10
|
+
type_reader nodes: Hash[String => TrieNode] | {}
|
|
12
11
|
type_reader params: Array[String] | Array
|
|
13
12
|
type_accessor line: Line | nil
|
|
14
13
|
|
data/lib/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: trees
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- maedi
|
|
8
|
-
bindir:
|
|
8
|
+
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
|
-
name:
|
|
13
|
+
name: lowtype
|
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
|
15
15
|
requirements:
|
|
16
|
-
- - "
|
|
16
|
+
- - "~>"
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: '
|
|
18
|
+
version: '1.4'
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
|
-
- - "
|
|
23
|
+
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: '
|
|
25
|
+
version: '1.4'
|
|
26
26
|
description: "A CLI framework where you write the literal terminal commands and \nTrees
|
|
27
|
-
breaks them apart into a tree of options.\n"
|
|
27
|
+
then breaks them apart into a tree of commands and options.\n"
|
|
28
28
|
email:
|
|
29
29
|
- maediprichard@gmail.com
|
|
30
30
|
executables: []
|