sub_object 1.1 → 1.1.1
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/ChangeLog +5 -0
- data/README.en.rdoc +4 -3
- data/lib/sub_object.rb +4 -3
- data/sub_object.gemspec +4 -3
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed3aa9b2dcec41ea0bb6e94d2d3c7379ddb60f8ee7edfa13d13ce7bfdd24fd9f
|
4
|
+
data.tar.gz: 1825b3790125e15b3169f2b278b14e1db076def2403585b109836061be031cce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ad4c9d134d9d0474348c7a21dafda7edbc9c4ad3ba35f986c797af1d94f2ef82404c43e8c5e0baaf1235fc808c8397dfbf9a0cd3400d22a3a5f168dd498563f
|
7
|
+
data.tar.gz: 5b462a180b8fd85e3b046a0b5df1df7d6b138c379639fc9b22fbe6289413c602fbdc84bf1ed927f379cab2fb5b432935a0ad2d74d2dc86b95ed8b97e6632a35d
|
data/ChangeLog
CHANGED
data/README.en.rdoc
CHANGED
@@ -54,7 +54,7 @@ As an example, the child class {SubString}[http://rubygems.org/gems/sub_string]
|
|
54
54
|
works as:
|
55
55
|
|
56
56
|
src = "abcdef"
|
57
|
-
ss = SubString.new(src, -4, 3) # => Similar to "abcdef"[-4,3]
|
57
|
+
ss = SubString.new(src, -4, 3, attr: (5..6)) # => Similar to "abcdef"[-4,3]
|
58
58
|
print ss # => "cde" (STDOUT)
|
59
59
|
ss+'3p' # => "cde3p"
|
60
60
|
ss.upcase # => "CDE"
|
@@ -62,6 +62,7 @@ works as:
|
|
62
62
|
ss.is_a?(String) # => true
|
63
63
|
"xy_"+ss # => "xy_cde"
|
64
64
|
"cde" == ss # => true
|
65
|
+
ss.attr # => (5..6) # user-specified instance-specific additional information
|
65
66
|
|
66
67
|
Internally the instance holds the source object. Therefore, as long
|
67
68
|
as the instance is alive, the source object is never garbage-collected (GC).
|
@@ -287,14 +288,14 @@ interface for annotation but with easily-browsable {ChangeLog}[https://github.co
|
|
287
288
|
|
288
289
|
=== Tests
|
289
290
|
|
290
|
-
Ruby codes under the directory <tt>test/</tt> are the test scripts.
|
291
|
+
The Ruby codes under the directory <tt>test/</tt> are the test scripts.
|
291
292
|
You can run them from the top directory as <tt>ruby test/test_****.rb</tt>
|
292
293
|
or simply run <tt>make test</tt>.
|
293
294
|
|
294
295
|
|
295
296
|
== Known bugs and Todo items
|
296
297
|
|
297
|
-
* This class ignores any optional (keyword) parameters for the methods. It is due to the fact Ruby {BasicObject#method_missing}[https://ruby-doc.org/core-2.6.5/BasicObject.html#method-i-method_missing] does not take them into account as of Ruby-2.6.5. It may change in future versions of Ruby.
|
298
|
+
* This class ignores any optional (keyword) parameters for the methods of the original class. It is due to the fact Ruby {BasicObject#method_missing}[https://ruby-doc.org/core-2.6.5/BasicObject.html#method-i-method_missing] does not take them into account as of Ruby-2.6.5. It may change in future versions of Ruby.
|
298
299
|
|
299
300
|
|
300
301
|
== Copyright
|
data/lib/sub_object.rb
CHANGED
@@ -86,9 +86,10 @@ class SubObject
|
|
86
86
|
|
87
87
|
# Returns a new instance of SubObject equivalent to source[ pos, size ]
|
88
88
|
#
|
89
|
-
# @param source [
|
90
|
-
# @param pos [Integer]
|
91
|
-
# @param size [Integer]
|
89
|
+
# @param source [Object] source Object
|
90
|
+
# @param pos [Integer, Object] The first index for the method +#[]+, usually the starting index position.
|
91
|
+
# @param size [Integer, Object] The second index for the method +#[]+, usually the size.
|
92
|
+
# @param attr: [Object] user-specified arbitrary object
|
92
93
|
def initialize(source, pos, size, attr: nil)
|
93
94
|
@source, @pos, @isize = source, pos, size
|
94
95
|
@attr = attr
|
data/sub_object.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'date'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = 'sub_object'.sub(/.*/){|c| (c == File.basename(Dir.pwd)) ? c : raise("ERROR: s.name=(#{c}) in gemspec seems wrong!")}
|
8
|
-
s.version = "1.1".sub(/.*/){|c| fs = Dir.glob('changelog{,.*}', File::FNM_CASEFOLD); raise('More than one ChangeLog exist!') if fs.size > 1; warn("WARNING: Version(s.version=#{c}) already exists in #{fs[0]} - ok?") if fs.size == 1 && !IO.readlines(fs[0]).grep(/^\(Version: #{Regexp.quote c}\)$/).empty? ; c } # n.b., In macOS, changelog and ChangeLog are identical in default.
|
8
|
+
s.version = "1.1.1".sub(/.*/){|c| fs = Dir.glob('changelog{,.*}', File::FNM_CASEFOLD); raise('More than one ChangeLog exist!') if fs.size > 1; warn("WARNING: Version(s.version=#{c}) already exists in #{fs[0]} - ok?") if fs.size == 1 && !IO.readlines(fs[0]).grep(/^\(Version: #{Regexp.quote c}\)$/).empty? ; c } # n.b., In macOS, changelog and ChangeLog are identical in default.
|
9
9
|
# s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
10
10
|
# s.bindir = 'bin'
|
11
11
|
# %w(sub_object).each do |f|
|
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
# File.executable?(path) ? s.executables << f : raise("ERROR: Executable (#{path}) is not executable!")
|
14
14
|
# end
|
15
15
|
s.authors = ["Masa Sakano"]
|
16
|
-
s.date = %q{2019-11-
|
16
|
+
s.date = %q{2019-11-12}.sub(/.*/){|c| (Date.parse(c) == Date.today) ? c : raise("ERROR: s.date=(#{c}) is not today!")}
|
17
17
|
s.summary = %q{Parent class for memory-efficient sub-Something}
|
18
18
|
s.description = %q{Class SubObject that is the parent class for Ruby SubString and SubArray classes and alike, providing the base interface. This and child classes use negligible memory space, as their instance holds the positional information only. It behaves exactly like the source object (duck-typing), except destructive modification is prohibited. If the original source object is destructively altered, the corresponding instance can detect it and issue warning.}
|
19
19
|
# s.email = %q{abc@example.com}
|
@@ -36,7 +36,8 @@ Gem::Specification.new do |s|
|
|
36
36
|
s.files.reject! { |fn| File.symlink? fn }
|
37
37
|
|
38
38
|
# s.add_runtime_dependency 'rails'
|
39
|
-
|
39
|
+
|
40
|
+
s.add_development_dependency "plain_text", [">= 0.6"]
|
40
41
|
s.homepage = %q{https://www.wisebabel.com}
|
41
42
|
s.rdoc_options = ["--charset=UTF-8"]
|
42
43
|
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sub_object
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masa Sakano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
12
|
-
dependencies:
|
11
|
+
date: 2019-11-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: plain_text
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.6'
|
13
27
|
description: Class SubObject that is the parent class for Ruby SubString and SubArray
|
14
28
|
classes and alike, providing the base interface. This and child classes use negligible
|
15
29
|
memory space, as their instance holds the positional information only. It behaves
|