treedent 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +4 -2
- data/CHANGELOG.md +0 -0
- data/README.md +5 -0
- data/lib/treedent/indented_line.rb +4 -3
- data/lib/treedent/node.rb +2 -2
- data/lib/treedent/version.rb +1 -1
- data/treedent.gemspec +2 -2
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1878bf058724bab25716e71029c7e41ea98c3a8b6f1ecffd3c0920ca75b6dc73
|
4
|
+
data.tar.gz: c9b193181785038f20d9ce58a10b540eec4c6ad1512f789dddedb2c3040b7097
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32890632bdf5fda43ac195fb1abdc94a767852acf9fc593c7418250d8e2018c2017533bddf9fa693ae25879b39fd123315739ceb07eebb70c429fa7cd3873a27
|
7
|
+
data.tar.gz: e999e84cb744934fac7af3929381e3769977d62af29c4d325ade8190c0e2d8b4b57acc26626a0b1301bc3e3197c7601e02af389f4732e01f232b4a84aef61ad2
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
File without changes
|
data/README.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Treedent
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/treedent.svg)](https://badge.fury.io/rb/treedent)
|
4
|
+
[![Build Status](https://travis-ci.org/Aupajo/treedent.svg?branch=master)](https://travis-ci.org/Aupajo/treedent)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/Aupajo/treedent.png)](https://codeclimate.com/github/Aupajo/treedent)
|
6
|
+
|
7
|
+
|
3
8
|
A command-line tool for generating `tree`-like formatted output from indented plain text.
|
4
9
|
|
5
10
|
## Installation
|
@@ -2,13 +2,14 @@ require 'strscan'
|
|
2
2
|
|
3
3
|
module Treedent
|
4
4
|
class IndentedLine < Struct.new(:indentation, :content)
|
5
|
-
WHITESPACE_PATTERN = /[ \t]
|
5
|
+
WHITESPACE_PATTERN = /[ \t]*/.freeze
|
6
6
|
|
7
7
|
def self.from(line_string)
|
8
8
|
scanner = StringScanner.new(line_string)
|
9
|
-
|
9
|
+
scan = scanner.scan(WHITESPACE_PATTERN)
|
10
|
+
indentation = (scan && scan.length) || 0
|
10
11
|
content = scanner.rest
|
11
|
-
|
12
|
+
new(indentation, content)
|
12
13
|
end
|
13
14
|
end
|
14
15
|
end
|
data/lib/treedent/node.rb
CHANGED
@@ -32,18 +32,18 @@ module Treedent
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def ancestors(&block)
|
35
|
-
return enum_for(:ancestors) unless block_given?
|
36
35
|
traverse_relationship(:parent, &block)
|
37
36
|
end
|
38
37
|
|
39
38
|
def successors(&block)
|
40
|
-
return enum_for(:successors) unless block_given?
|
41
39
|
traverse_relationship(:successor, &block)
|
42
40
|
end
|
43
41
|
|
44
42
|
private
|
45
43
|
|
46
44
|
def traverse_relationship(relation, &block)
|
45
|
+
return enum_for(:traverse_relationship, relation) unless block_given?
|
46
|
+
|
47
47
|
node = self
|
48
48
|
yield node while node = node.public_send(relation)
|
49
49
|
end
|
data/lib/treedent/version.rb
CHANGED
data/treedent.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.add_development_dependency "bundler", "~> 1
|
24
|
-
spec.add_development_dependency "rake", "~>
|
23
|
+
spec.add_development_dependency "bundler", "~> 2.1"
|
24
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
25
25
|
spec.add_development_dependency "minitest", "~> 5.0"
|
26
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: treedent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Nicholls
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1
|
19
|
+
version: '2.1'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1
|
26
|
+
version: '2.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '13.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '13.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -62,6 +62,7 @@ extra_rdoc_files: []
|
|
62
62
|
files:
|
63
63
|
- ".gitignore"
|
64
64
|
- ".travis.yml"
|
65
|
+
- CHANGELOG.md
|
65
66
|
- CODE_OF_CONDUCT.md
|
66
67
|
- Gemfile
|
67
68
|
- LICENSE.txt
|
@@ -99,8 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
100
|
- !ruby/object:Gem::Version
|
100
101
|
version: '0'
|
101
102
|
requirements: []
|
102
|
-
|
103
|
-
rubygems_version: 2.6.8
|
103
|
+
rubygems_version: 3.1.2
|
104
104
|
signing_key:
|
105
105
|
specification_version: 4
|
106
106
|
summary: A command-line tool for formatting indented text like `tree`.
|