psychgus 1.2.0 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +4 -0
- data/CHANGELOG.md +58 -3
- data/Gemfile +0 -18
- data/README.md +38 -43
- data/Rakefile +33 -126
- data/lib/psychgus.rb +178 -186
- data/lib/psychgus/blueberry.rb +28 -39
- data/lib/psychgus/ext.rb +6 -17
- data/lib/psychgus/ext/core_ext.rb +17 -28
- data/lib/psychgus/ext/node_ext.rb +13 -24
- data/lib/psychgus/ext/yaml_tree_ext.rb +23 -34
- data/lib/psychgus/stylables.rb +78 -89
- data/lib/psychgus/styled_document_stream.rb +14 -25
- data/lib/psychgus/styled_tree_builder.rb +90 -101
- data/lib/psychgus/styler.rb +33 -44
- data/lib/psychgus/stylers.rb +67 -78
- data/lib/psychgus/super_sniffer.rb +128 -138
- data/lib/psychgus/super_sniffer/parent.rb +48 -149
- data/lib/psychgus/version.rb +4 -16
- data/psychgus.gemspec +46 -49
- data/test/blueberry_test.rb +30 -41
- data/test/psychgus_test.rb +73 -54
- data/test/psychgus_tester.rb +23 -31
- data/test/sniffer_test.rb +18 -32
- data/test/styler_test.rb +20 -31
- data/test/stylers_test.rb +32 -43
- metadata +38 -23
data/test/stylers_test.rb
CHANGED
@@ -1,22 +1,11 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
1
|
# encoding: UTF-8
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
4
|
#--
|
5
5
|
# This file is part of Psychgus.
|
6
|
-
# Copyright (c) 2019 Jonathan Bradley Whited
|
7
|
-
#
|
8
|
-
#
|
9
|
-
# it under the terms of the GNU Lesser General Public License as published by
|
10
|
-
# the Free Software Foundation, either version 3 of the License, or
|
11
|
-
# (at your option) any later version.
|
12
|
-
#
|
13
|
-
# Psychgus is distributed in the hope that it will be useful,
|
14
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16
|
-
# GNU Lesser General Public License for more details.
|
17
|
-
#
|
18
|
-
# You should have received a copy of the GNU Lesser General Public License
|
19
|
-
# along with Psychgus. If not, see <http://www.gnu.org/licenses/>.
|
6
|
+
# Copyright (c) 2019-2021 Jonathan Bradley Whited
|
7
|
+
#
|
8
|
+
# SPDX-License-Identifier: LGPL-3.0-or-later
|
20
9
|
#++
|
21
10
|
|
22
11
|
|
@@ -24,14 +13,14 @@ require 'psychgus_tester'
|
|
24
13
|
|
25
14
|
class EggCarton
|
26
15
|
include Psychgus::Blueberry
|
27
|
-
|
28
|
-
def initialize
|
16
|
+
|
17
|
+
def initialize
|
29
18
|
@eggs = {
|
30
|
-
:
|
31
|
-
:
|
19
|
+
styles: ['omelette','BBQ eggs','hard-boiled eggs','soft_boiled eggs','fried@eggs'],
|
20
|
+
colors: ['brown','white',['blue','green']]
|
32
21
|
}
|
33
22
|
end
|
34
|
-
|
23
|
+
|
35
24
|
def psychgus_stylers(sniffer)
|
36
25
|
return Psychgus::FlowStyler.new(4)
|
37
26
|
end
|
@@ -41,53 +30,53 @@ end
|
|
41
30
|
# @since 1.2.0
|
42
31
|
###
|
43
32
|
class StylersTest < PsychgusTester
|
44
|
-
def setup
|
45
|
-
@egg_carton = EggCarton.new
|
33
|
+
def setup
|
34
|
+
@egg_carton = EggCarton.new
|
46
35
|
end
|
47
|
-
|
48
|
-
def test_capstyler
|
36
|
+
|
37
|
+
def test_capstyler
|
49
38
|
actual = @egg_carton.to_yaml(stylers: Psychgus::CapStyler.new(each_word: false))
|
50
|
-
expected = <<-
|
39
|
+
expected = <<-YAML
|
51
40
|
|--- !ruby/object:EggCarton
|
52
41
|
|Eggs:
|
53
42
|
| :styles: [Omelette, BBQ eggs, Hard-boiled eggs, Soft_boiled eggs, Fried@eggs]
|
54
43
|
| :colors: [Brown, White, [Blue, Green]]
|
55
|
-
|
56
|
-
|
44
|
+
YAML
|
45
|
+
|
57
46
|
assert_equal self.class.lstrip_pipe(expected),actual
|
58
|
-
|
47
|
+
|
59
48
|
actual = @egg_carton.to_yaml(stylers: Psychgus::CapStyler.new(new_delim: '+',delim: /[\s_\-@]/))
|
60
|
-
expected = <<-
|
49
|
+
expected = <<-YAML
|
61
50
|
|--- !ruby/object:EggCarton
|
62
51
|
|Eggs:
|
63
52
|
| :styles: [Omelette, BBQ+Eggs, Hard+Boiled+Eggs, Soft+Boiled+Eggs, Fried+Eggs]
|
64
53
|
| :colors: [Brown, White, [Blue, Green]]
|
65
|
-
|
66
|
-
|
54
|
+
YAML
|
55
|
+
|
67
56
|
assert_equal self.class.lstrip_pipe(expected),actual
|
68
57
|
end
|
69
|
-
|
70
|
-
def test_nosymstyler
|
71
|
-
actual = @egg_carton.to_yaml(stylers: Psychgus::NoSymStyler.new
|
72
|
-
expected = <<-
|
58
|
+
|
59
|
+
def test_nosymstyler
|
60
|
+
actual = @egg_carton.to_yaml(stylers: Psychgus::NoSymStyler.new)
|
61
|
+
expected = <<-YAML
|
73
62
|
|--- !ruby/object:EggCarton
|
74
63
|
|eggs:
|
75
64
|
| Styles: [omelette, BBQ eggs, hard-boiled eggs, soft_boiled eggs, fried@eggs]
|
76
65
|
| Colors: [brown, white, [blue, green]]
|
77
|
-
|
78
|
-
|
66
|
+
YAML
|
67
|
+
|
79
68
|
assert_equal self.class.lstrip_pipe(expected),actual
|
80
69
|
end
|
81
|
-
|
82
|
-
def test_notagstyler
|
83
|
-
actual = @egg_carton.to_yaml(stylers: Psychgus::NoTagStyler.new
|
84
|
-
expected = <<-
|
70
|
+
|
71
|
+
def test_notagstyler
|
72
|
+
actual = @egg_carton.to_yaml(stylers: Psychgus::NoTagStyler.new)
|
73
|
+
expected = <<-YAML
|
85
74
|
|---
|
86
75
|
|eggs:
|
87
76
|
| :styles: [omelette, BBQ eggs, hard-boiled eggs, soft_boiled eggs, fried@eggs]
|
88
77
|
| :colors: [brown, white, [blue, green]]
|
89
|
-
|
90
|
-
|
78
|
+
YAML
|
79
|
+
|
91
80
|
assert_equal self.class.lstrip_pipe(expected),actual
|
92
81
|
end
|
93
82
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: psychgus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Jonathan Bradley Whited
|
8
|
-
autorequire:
|
7
|
+
- Jonathan Bradley Whited
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: psych
|
@@ -16,84 +16,84 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '3.0'
|
20
20
|
type: :runtime
|
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:
|
26
|
+
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.2'
|
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: '2.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '5.
|
47
|
+
version: '5.14'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '5.
|
54
|
+
version: '5.14'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '13.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '13.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rdoc
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '6.
|
75
|
+
version: '6.3'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '6.
|
82
|
+
version: '6.3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: redcarpet
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '3.
|
89
|
+
version: '3.5'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '3.
|
96
|
+
version: '3.5'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: yard
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,13 +108,28 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0.9'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: yard_ghurt
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.2'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.2'
|
111
125
|
description: Easily style YAML files using Psych, like Sequence/Mapping Flow style.
|
112
126
|
email:
|
113
|
-
-
|
127
|
+
- code@esotericpig.com
|
114
128
|
executables: []
|
115
129
|
extensions: []
|
116
130
|
extra_rdoc_files: []
|
117
131
|
files:
|
132
|
+
- ".yardopts"
|
118
133
|
- CHANGELOG.md
|
119
134
|
- Gemfile
|
120
135
|
- LICENSE.txt
|
@@ -146,12 +161,12 @@ homepage: https://github.com/esotericpig/psychgus
|
|
146
161
|
licenses:
|
147
162
|
- LGPL-3.0-or-later
|
148
163
|
metadata:
|
164
|
+
homepage_uri: https://github.com/esotericpig/psychgus
|
165
|
+
source_code_uri: https://github.com/esotericpig/psychgus
|
149
166
|
bug_tracker_uri: https://github.com/esotericpig/psychgus/issues
|
150
167
|
changelog_uri: https://github.com/esotericpig/psychgus/blob/master/CHANGELOG.md
|
151
168
|
documentation_uri: https://esotericpig.github.io/docs/psychgus/yardoc/index.html
|
152
|
-
|
153
|
-
source_code_uri: https://github.com/esotericpig/psychgus
|
154
|
-
post_install_message:
|
169
|
+
post_install_message:
|
155
170
|
rdoc_options: []
|
156
171
|
require_paths:
|
157
172
|
- lib
|
@@ -166,8 +181,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
181
|
- !ruby/object:Gem::Version
|
167
182
|
version: '0'
|
168
183
|
requirements: []
|
169
|
-
rubygems_version: 3.
|
170
|
-
signing_key:
|
184
|
+
rubygems_version: 3.2.15
|
185
|
+
signing_key:
|
171
186
|
specification_version: 4
|
172
|
-
summary: Easily style YAML files using Psych
|
187
|
+
summary: Easily style YAML files using Psych.
|
173
188
|
test_files: []
|