prettyprint 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +18 -7
- data/README.md +16 -9
- data/lib/prettyprint.rb +3 -3
- data/prettyprint.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e74982e516f7a3b43592ee38c1b5b2b02a15fcc9a3efe340675eed7948dcae64
|
4
|
+
data.tar.gz: 9d45a65376c2a7fd967471ca04aeb03378b2c4b9a8ab4d656c77711408de6ed1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 463fe2cbf864af4b6a9fc22da78c752221312cb85673e1be324cfd4576ef6c301ab507f0413bf339f3a4c22dc50372f128c57df363b647c00765f97702d44694
|
7
|
+
data.tar.gz: ebd53848ad27a8780a87016b809dbeeb411269c15331b30224bd6187c465776a2ae890bcc1400745d7926e37f5bc4b9828d39962fa27b166d9c874c088180819
|
data/.github/workflows/test.yml
CHANGED
@@ -1,24 +1,35 @@
|
|
1
1
|
name: test
|
2
2
|
|
3
|
-
on:
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
pull_request:
|
6
|
+
schedule:
|
7
|
+
- cron: '15 3 * * *'
|
4
8
|
|
5
9
|
jobs:
|
6
10
|
build:
|
7
11
|
name: build (${{ matrix.ruby }} / ${{ matrix.os }})
|
8
12
|
strategy:
|
9
13
|
matrix:
|
10
|
-
ruby: [ 2.7, 2.6, 2.5
|
11
|
-
os: [ ubuntu-latest, macos-latest ]
|
14
|
+
ruby: [ head, '3.0', '2.7', '2.6', '2.5' ]
|
15
|
+
os: [ ubuntu-latest, macos-latest, windows-latest ]
|
16
|
+
exclude:
|
17
|
+
- { os: windows-latest , ruby: head }
|
18
|
+
include:
|
19
|
+
- { os: windows-latest , ruby: mingw }
|
20
|
+
- { os: windows-latest , ruby: mswin }
|
12
21
|
runs-on: ${{ matrix.os }}
|
13
22
|
steps:
|
14
|
-
- uses: actions/checkout@
|
23
|
+
- uses: actions/checkout@v2
|
15
24
|
- name: Set up Ruby
|
16
25
|
uses: ruby/setup-ruby@v1
|
17
26
|
with:
|
18
27
|
ruby-version: ${{ matrix.ruby }}
|
19
28
|
- name: Install dependencies
|
20
|
-
run:
|
21
|
-
|
22
|
-
|
29
|
+
run: bundle install
|
30
|
+
- name: Build
|
31
|
+
run: rake build
|
23
32
|
- name: Run test
|
24
33
|
run: rake test
|
34
|
+
- name: Installation test
|
35
|
+
run: gem install pkg/*.gem
|
data/README.md
CHANGED
@@ -1,8 +1,20 @@
|
|
1
|
-
#
|
1
|
+
# PrettyPrint
|
2
2
|
|
3
|
-
|
3
|
+
This class implements a pretty printing algorithm. It finds line breaks and
|
4
|
+
nice indentations for grouped structure.
|
4
5
|
|
5
|
-
|
6
|
+
By default, the class assumes that primitive elements are strings and each
|
7
|
+
byte in the strings have single column in width. But it can be used for
|
8
|
+
other situations by giving suitable arguments for some methods:
|
9
|
+
|
10
|
+
* newline object and space generation block for PrettyPrint.new
|
11
|
+
* optional width argument for PrettyPrint#text
|
12
|
+
* PrettyPrint#breakable
|
13
|
+
|
14
|
+
There are several candidate uses:
|
15
|
+
|
16
|
+
* text formatting using proportional fonts
|
17
|
+
* multibyte characters which has columns different to number of bytes
|
6
18
|
|
7
19
|
## Installation
|
8
20
|
|
@@ -20,10 +32,6 @@ Or install it yourself as:
|
|
20
32
|
|
21
33
|
$ gem install prettyprint
|
22
34
|
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
35
|
## Development
|
28
36
|
|
29
37
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -32,5 +40,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
40
|
|
33
41
|
## Contributing
|
34
42
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
36
|
-
|
43
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/prettyprint.
|
data/lib/prettyprint.rb
CHANGED
@@ -102,7 +102,7 @@ class PrettyPrint
|
|
102
102
|
|
103
103
|
# The maximum width of a line, before it is separated in to a newline
|
104
104
|
#
|
105
|
-
# This defaults to 79, and should be
|
105
|
+
# This defaults to 79, and should be an Integer
|
106
106
|
attr_reader :maxwidth
|
107
107
|
|
108
108
|
# The value that is appended to +output+ to add a new line.
|
@@ -110,7 +110,7 @@ class PrettyPrint
|
|
110
110
|
# This defaults to "\n", and should be String
|
111
111
|
attr_reader :newline
|
112
112
|
|
113
|
-
# A lambda or Proc, that takes one argument, of
|
113
|
+
# A lambda or Proc, that takes one argument, of an Integer, and returns
|
114
114
|
# the corresponding number of spaces.
|
115
115
|
#
|
116
116
|
# By default this is:
|
@@ -340,7 +340,7 @@ class PrettyPrint
|
|
340
340
|
#
|
341
341
|
# Arguments:
|
342
342
|
# * +sep+ String of the separator
|
343
|
-
# * +width+
|
343
|
+
# * +width+ Integer width of the +sep+
|
344
344
|
# * +q+ parent PrettyPrint object, to base from
|
345
345
|
def initialize(sep, width, q)
|
346
346
|
@obj = sep
|
data/prettyprint.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prettyprint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tanaka Akira
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Implements a pretty printing algorithm for readable structure.
|
14
14
|
email:
|
@@ -49,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '0'
|
51
51
|
requirements: []
|
52
|
-
rubygems_version: 3.
|
52
|
+
rubygems_version: 3.3.0.dev
|
53
53
|
signing_key:
|
54
54
|
specification_version: 4
|
55
55
|
summary: Implements a pretty printing algorithm for readable structure.
|