psychgus 1.3.3 → 1.3.4
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/.yardopts +4 -0
- data/CHANGELOG.md +22 -7
- data/Gemfile +0 -18
- data/README.md +27 -28
- data/Rakefile +20 -42
- data/lib/psychgus.rb +169 -179
- 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 +111 -123
- data/lib/psychgus/super_sniffer/parent.rb +42 -51
- data/lib/psychgus/version.rb +4 -16
- data/psychgus.gemspec +39 -43
- data/test/blueberry_test.rb +30 -41
- data/test/psychgus_test.rb +51 -60
- 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 +15 -14
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.3.
|
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
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '2.
|
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: '2.
|
40
|
+
version: '2.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
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
|
@@ -124,11 +124,12 @@ dependencies:
|
|
124
124
|
version: '1.2'
|
125
125
|
description: Easily style YAML files using Psych, like Sequence/Mapping Flow style.
|
126
126
|
email:
|
127
|
-
-
|
127
|
+
- code@esotericpig.com
|
128
128
|
executables: []
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
+
- ".yardopts"
|
132
133
|
- CHANGELOG.md
|
133
134
|
- Gemfile
|
134
135
|
- LICENSE.txt
|
@@ -160,12 +161,12 @@ homepage: https://github.com/esotericpig/psychgus
|
|
160
161
|
licenses:
|
161
162
|
- LGPL-3.0-or-later
|
162
163
|
metadata:
|
164
|
+
homepage_uri: https://github.com/esotericpig/psychgus
|
165
|
+
source_code_uri: https://github.com/esotericpig/psychgus
|
163
166
|
bug_tracker_uri: https://github.com/esotericpig/psychgus/issues
|
164
167
|
changelog_uri: https://github.com/esotericpig/psychgus/blob/master/CHANGELOG.md
|
165
168
|
documentation_uri: https://esotericpig.github.io/docs/psychgus/yardoc/index.html
|
166
|
-
|
167
|
-
source_code_uri: https://github.com/esotericpig/psychgus
|
168
|
-
post_install_message:
|
169
|
+
post_install_message:
|
169
170
|
rdoc_options: []
|
170
171
|
require_paths:
|
171
172
|
- lib
|
@@ -180,8 +181,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
180
181
|
- !ruby/object:Gem::Version
|
181
182
|
version: '0'
|
182
183
|
requirements: []
|
183
|
-
rubygems_version: 3.
|
184
|
-
signing_key:
|
184
|
+
rubygems_version: 3.2.15
|
185
|
+
signing_key:
|
185
186
|
specification_version: 4
|
186
187
|
summary: Easily style YAML files using Psych.
|
187
188
|
test_files: []
|