indented_io 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/indented_io/indented_io.rb +5 -5
- data/lib/indented_io/indented_io_interface.rb +2 -1
- data/lib/indented_io/kernel.rb +1 -1
- data/lib/indented_io/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a3aea4e6d92b93cbbf46b1cedc65269dcf98a0d3e1c004a80326ea42ffbbedd
|
4
|
+
data.tar.gz: e6978c9ada704f54f82cbf36cd49d144f99ae8c5e8ae4c6f04a46a0536a95047
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a477fc1cafb6b0f671c167232f9805f548d291f000aff6423ff370e8786e11fc1bfd514730ea054b82518971281e915137ed7ad754300e989da2811810fae7d9
|
7
|
+
data.tar.gz: 2a051a896d10d75fe8a0f1d3f5bf38bb6cf4746cd4cad75fbdb578abe2d70ce17db36136bca29f2c4a038608d88df89c5cb5286bd57f8c6e031868bfbaaf285f
|
data/README.md
CHANGED
@@ -53,8 +53,8 @@ module IndentedIO
|
|
53
53
|
end
|
54
54
|
|
55
55
|
# Indent and print args to the underlying device. #p has the same semantic
|
56
|
-
# as Kernel#p. Please note that #p is
|
57
|
-
#
|
56
|
+
# as Kernel#p. Please note that #p is only defined on Kernel in the Ruby core
|
57
|
+
# library but can be used on any IndentedIO object
|
58
58
|
def p(*args)
|
59
59
|
if bol
|
60
60
|
args.each { |arg| write(arg.inspect, "\n") }
|
@@ -69,7 +69,7 @@ module IndentedIO
|
|
69
69
|
# Make IndentedIO behave like the underlying @device
|
70
70
|
# @!visibility private
|
71
71
|
def respond_to?(method)
|
72
|
-
[:indent, :level, :print, :puts, :p].include?(method) || device.respond_to?(method)
|
72
|
+
[:indent, :level, :print, :printf, :puts, :p].include?(method) || device.respond_to?(method)
|
73
73
|
end
|
74
74
|
|
75
75
|
# Make IndentedIO behave like the underlying @device
|
@@ -85,8 +85,8 @@ module IndentedIO
|
|
85
85
|
attr_reader :device
|
86
86
|
|
87
87
|
# First IndentedIO object on the stack. Equal to self if self is the first
|
88
|
-
# indentation object. #base is used to keep track of #bol for
|
89
|
-
# stack of IndentedIO objects
|
88
|
+
# indentation object. The #base object is used to keep track of #bol for
|
89
|
+
# the whole stack of IndentedIO objects
|
90
90
|
attr_reader :base
|
91
91
|
|
92
92
|
# Parent IndentedIO or IO object
|
@@ -4,6 +4,7 @@ module IndentedIO
|
|
4
4
|
# #write method like this:
|
5
5
|
#
|
6
6
|
# require 'indented_io'
|
7
|
+
#
|
7
8
|
# class MyIO
|
8
9
|
# include IndentedIO::IndentedIOInterface
|
9
10
|
# def write(*args) ... end
|
@@ -18,7 +19,7 @@ module IndentedIO
|
|
18
19
|
#
|
19
20
|
module IndentedIOInterface
|
20
21
|
# Returns a IndentedIO object that can be used for printing. The IO object
|
21
|
-
# will pass-through all
|
22
|
+
# will pass-through all methods to the underlying device except #print,
|
22
23
|
# #printf, #puts, and #p
|
23
24
|
#
|
24
25
|
# +level+ is the number of leves to indent and +string+ is the string used
|
data/lib/indented_io/kernel.rb
CHANGED
@@ -3,7 +3,7 @@ require 'indented_io/indented_io_interface'
|
|
3
3
|
module Kernel
|
4
4
|
# Like {IndentedIO::IndentedIOInterface#indent} except the underlying device is
|
5
5
|
# not the receiver (Kernel) but $stdout. Kernel#indent also allows a block without
|
6
|
-
#
|
6
|
+
# an argument. In that case it manipulates $stdout to print indented:
|
7
7
|
#
|
8
8
|
# puts "Not indented
|
9
9
|
# indent do
|
data/lib/indented_io/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: indented_io
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claus Rasmussen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|