lazy_string 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7ef828d0d6e270b3c763849c5503bef8434ac156e487d517b528ec64d5c4ab4
4
- data.tar.gz: 4cbba8428b89845019b048a1bbb700f2dcaeda71c853f849ef9462914e364293
3
+ metadata.gz: b95d72633b9419e5306c154c7adda01b3ea723d39d4bf3ee58b41111371bc128
4
+ data.tar.gz: 2fde23cece3bb04dec3570ab777fd8cf6528024dc1ead33ac2d6dae9d8fde974
5
5
  SHA512:
6
- metadata.gz: ee16dc18e4c5035ee131cfa0c92e3bc1c5f6fcd1f7cacc5c9c3a8632c20fecc1683781c2498340e2a322c8c077eea2beea90238ac0bb3839a025c96fb136730c
7
- data.tar.gz: '048e4f0fea648cb3655db2042b174ddc13e81d3f9933d166542e3bf61c15e1e005cf47a1b1594fb2833c88f2c1adad4c0b445a6e077a1d8ac62d95cdb75fc1f5'
6
+ metadata.gz: 5ea1f4d2c963a844fe677fdf59bf866b8ce33a323997357f243301640f79fb73dc15f45e7ff456db8274120de018a96d7aa36a5d782186299855ba9123e60699
7
+ data.tar.gz: 375eb324a2af06e24b661eabce5e674420eb476f33a8165b457123dacb86fbf67148a391d8f24f4839e480b517f8d4be11899e8944283c570fc71e3e8da0de6d
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2018 Aaron Beckerman
1
+ Copyright (c) 2022 Aaron Beckerman
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.txt CHANGED
@@ -1,9 +1,8 @@
1
1
  LazyString
2
2
 
3
- LazyString is a Ruby class for computing strings only when necessary -- that
4
- is, when #to_str or #to_s is called. This is useful when computing the string
5
- is expensive, but the string is unlikely to be used: an error message passed as
6
- a method argument, for example.
3
+ LazyString is a Ruby class for computing strings only when necessary. This is
4
+ useful when computing the string is expensive but the string is unlikely to be
5
+ used: an error message passed as an argument, for example.
7
6
 
8
7
  Thanks to duck typing and Ruby's standard conversion protocols, you can pass
9
8
  an instance of LazyString to many methods that ask for a string.
@@ -17,7 +16,7 @@ file, you can create a lazy string by passing a block to LazyString.new:
17
16
  ls = LazyString.new { "answer = #{expensive_computation}" }
18
17
 
19
18
  The block (and therefore expensive_computation) will not be called immediately.
20
- But later, if #to_str or #to_s is called on the lazy string, the block will be
19
+ But later, if #to_str or #to_s is sent to the lazy string, the block will be
21
20
  called with no arguments in order to create the real string.
22
21
 
23
22
  # String interpolation calls #to_s automatically.
data/lazy_string.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
7
7
  gem.name = 'lazy_string'
8
8
  gem.version = LazyString::VERSION
9
9
  gem.authors = ['Aaron Beckerman']
10
- gem.description = %q{This library provides LazyString, a class for computing strings only when necessary -- that is, when #to_str or #to_s is called. This is useful when computing the string is expensive but the string is unlikely to be used: an error message passed as a method argument, for example.}
10
+ gem.description = %q{This library provides LazyString, a class for computing strings only when necessary. This is useful when computing the string is expensive but the string is unlikely to be used: an error message passed as an argument, for example.}
11
11
  gem.summary = %q{A Ruby library for lazily computing strings.}
12
12
  gem.license = 'MIT'
13
13
  gem.required_ruby_version = '>= 1.8.7'
data/lib/lazy_string.rb CHANGED
@@ -1,14 +1,13 @@
1
1
  ##
2
- # LazyString is a class for computing strings only when necessary -- that is,
3
- # when #to_str or #to_s is called. This is useful when computing the string is
4
- # expensive, but the string is unlikely to be used: an error message passed as
5
- # a method argument, for example.
2
+ # LazyString is a class for computing strings only when necessary. This is
3
+ # useful when computing the string is expensive but the string is unlikely to
4
+ # be used: an error message passed as an argument, for example.
6
5
  #
7
6
  class LazyString
8
7
  ##
9
8
  # The version string.
10
9
  #
11
- VERSION = '0.3.0'
10
+ VERSION = '0.4.0'
12
11
 
13
12
  ##
14
13
  # Creates a new lazy string. The block argument will be saved for later use
@@ -29,10 +28,10 @@ class LazyString
29
28
  ##
30
29
  # Returns the computed string. It will compute the string by calling (with no
31
30
  # arguments) the block passed to ::new. If the block's return value responds
32
- # to the \to_str message, \to_str will be called on it to create the string.
33
- # Otherwise, \to_s will be called on it. The computed string will be saved,
34
- # so subsequent calls of this method will not cause the block to be called
35
- # again.
31
+ # to the \to_str message, \to_str will be sent to it to create the string.
32
+ # Otherwise, \to_s will be sent to it. The computed string will be saved,
33
+ # so subsequent invocations of this method will not cause the block to be
34
+ # called again.
36
35
  #
37
36
  def to_str
38
37
  @str ||= begin
metadata CHANGED
@@ -1,20 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lazy_string
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Beckerman
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-28 00:00:00.000000000 Z
11
+ date: 2022-11-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'This library provides LazyString, a class for computing strings only
14
- when necessary -- that is, when #to_str or #to_s is called. This is useful when
15
- computing the string is expensive but the string is unlikely to be used: an error
16
- message passed as a method argument, for example.'
17
- email:
14
+ when necessary. This is useful when computing the string is expensive but the string
15
+ is unlikely to be used: an error message passed as an argument, for example.'
16
+ email:
18
17
  executables: []
19
18
  extensions: []
20
19
  extra_rdoc_files: []
@@ -24,11 +23,11 @@ files:
24
23
  - lazy_string.gemspec
25
24
  - lib/lazy_string.rb
26
25
  - test/lazy_string_test.rb
27
- homepage:
26
+ homepage:
28
27
  licenses:
29
28
  - MIT
30
29
  metadata: {}
31
- post_install_message:
30
+ post_install_message:
32
31
  rdoc_options: []
33
32
  require_paths:
34
33
  - lib
@@ -43,9 +42,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
43
42
  - !ruby/object:Gem::Version
44
43
  version: '0'
45
44
  requirements: []
46
- rubyforge_project:
47
- rubygems_version: 2.7.6
48
- signing_key:
45
+ rubygems_version: 3.3.7
46
+ signing_key:
49
47
  specification_version: 4
50
48
  summary: A Ruby library for lazily computing strings.
51
49
  test_files: