ruby-brs 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,13 +13,13 @@ module BRS
13
13
  write object
14
14
  end
15
15
 
16
- def print(*objects)
16
+ def print(*objects, field_separator: $OUTPUT_FIELD_SEPARATOR, record_separator: $OUTPUT_RECORD_SEPARATOR)
17
17
  objects.each do |object|
18
18
  write object
19
- write $OUTPUT_FIELD_SEPARATOR unless $OUTPUT_FIELD_SEPARATOR.nil?
19
+ write field_separator unless field_separator.nil?
20
20
  end
21
21
 
22
- write $OUTPUT_RECORD_SEPARATOR unless $OUTPUT_RECORD_SEPARATOR.nil?
22
+ write record_separator unless record_separator.nil?
23
23
 
24
24
  nil
25
25
  end
@@ -31,9 +31,10 @@ module BRS
31
31
  end
32
32
 
33
33
  def putc(object, encoding: ::Encoding::BINARY)
34
- if object.is_a? ::Numeric
34
+ case object
35
+ when ::Numeric
35
36
  write object.chr(encoding)
36
- elsif object.is_a? ::String
37
+ when ::String
37
38
  write object[0]
38
39
  else
39
40
  raise ValidateError, "invalid object: \"#{object}\" for putc"
@@ -5,12 +5,25 @@ require_relative "error"
5
5
 
6
6
  module BRS
7
7
  module Validation
8
+ IO_METHODS = %i[
9
+ read
10
+ write
11
+ readpartial
12
+ read_nonblock
13
+ write_nonblock
14
+ eof?
15
+ flush
16
+ close
17
+ closed?
18
+ ]
19
+ .freeze
20
+
8
21
  def self.validate_bool(value)
9
22
  raise ValidateError, "invalid bool" unless value.is_a?(::TrueClass) || value.is_a?(::FalseClass)
10
23
  end
11
24
 
12
25
  def self.validate_positive_integer(value)
13
- raise ValidateError, "invalid positive integer" unless value.is_a?(::Integer) && value > 0
26
+ raise ValidateError, "invalid positive integer" unless value.is_a?(::Integer) && value.positive?
14
27
  end
15
28
 
16
29
  def self.validate_not_negative_integer(value)
@@ -26,7 +39,7 @@ module BRS
26
39
  end
27
40
 
28
41
  def self.validate_io(value)
29
- raise ValidateError, "invalid io" unless value.is_a? ::IO
42
+ raise ValidateError, "invalid io" unless IO_METHODS.all? { |method| value.respond_to? method }
30
43
  end
31
44
 
32
45
  def self.validate_hash(value)
@@ -2,5 +2,5 @@
2
2
  # Copyright (c) 2019 AUTHORS, MIT License.
3
3
 
4
4
  module BRS
5
- VERSION = "1.1.1".freeze
5
+ VERSION = "1.2.0".freeze
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-brs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Aladjev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-02 00:00:00.000000000 Z
11
+ date: 2020-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: codecov
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '5.12'
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.12'
54
+ version: '5.14'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: ocg
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.1'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rake
70
+ name: parallel
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rake-compiler
84
+ name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,47 +95,47 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rubocop
98
+ name: rake-compiler
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: '0.75'
103
+ version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: '0.75'
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rubocop-performance
112
+ name: rubocop
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '1.5'
117
+ version: '0.93'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '1.5'
124
+ version: '0.93'
125
125
  - !ruby/object:Gem::Dependency
126
- name: rubocop-rails
126
+ name: rubocop-performance
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '2.3'
131
+ version: '1.8'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '2.3'
138
+ version: '1.8'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: simplecov
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -165,6 +165,7 @@ files:
165
165
  - ext/brs_ext/common.h
166
166
  - ext/brs_ext/error.c
167
167
  - ext/brs_ext/error.h
168
+ - ext/brs_ext/gvl.h
168
169
  - ext/brs_ext/io.c
169
170
  - ext/brs_ext/io.h
170
171
  - ext/brs_ext/macro.h
@@ -207,14 +208,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
207
208
  requirements:
208
209
  - - ">="
209
210
  - !ruby/object:Gem::Version
210
- version: '0'
211
+ version: '2.5'
211
212
  required_rubygems_version: !ruby/object:Gem::Requirement
212
213
  requirements:
213
214
  - - ">="
214
215
  - !ruby/object:Gem::Version
215
216
  version: '0'
216
217
  requirements: []
217
- rubygems_version: 3.0.6
218
+ rubygems_version: 3.1.4
218
219
  signing_key:
219
220
  specification_version: 4
220
221
  summary: Ruby bindings for brotli library.