ruby-rails-extensions 2.2.0 → 2.3.0.rc.pre.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49b190ddafb371c08f8575f436b5413ccba9965dbd4a9da80b8c3452fcba4a20
4
- data.tar.gz: ed03c3179e1a86ca4575056183189c6811a61ce579b6cb8e4fa2de3504ba539a
3
+ metadata.gz: 541166471417caf89e3f04bb8a03136c2b6e9702ec76507e565eb79a736dd824
4
+ data.tar.gz: dcbbed73afa3c5f4d67d99646c3d637a6ffe5aa14da4ff1e65ad662a13756962
5
5
  SHA512:
6
- metadata.gz: 9724a504cf8200c514c942d5f85c1c1ac63f2fc6182719f0d209f9fc79096d68cb8d2746941215eab4e38b51f31df1f78b667b8ea058cbab0d7a266d200d251b
7
- data.tar.gz: 1ba5c494a7752b5ca3d59ce9aec0e5a3eb648e0ae5591f2031fe72f1b5e258530890320fcea76e4e0ecc7ee3d2bb63e530f84a1baf4cb34fa6f9954be916c0c8
6
+ metadata.gz: e1d7fc97453a87800cd51e455e0e3f2079f7ee71c740351f28d32cf1d96e02542d370e3bd50f2b0222e80b4eb43ee1c155261aae35b35fd71c2807c78b24a54d
7
+ data.tar.gz: 26c09e794f57530e4dd6daed4067e57bb6ab53b03ad235ec1291924c837651fa416d7411f94e4fc571bc91c4fb84a694fa5de48b501fc88986cf4d8507331972
data/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 2.3.0 (2025-12-23)
5
+ ------------------
6
+ * Modules added:
7
+ * `String#word_wrap`
8
+ * Other changes:
9
+ * Updated rake task for new gem creation to use `class` instead of `class_eval`
10
+ * Added devcontainer support
11
+ * Changed the `VERSION` module structure
12
+ * Corrected RSpecs to standard
13
+
4
14
  2.2.0 (2025-07-29)
5
15
  ------------------
6
16
 
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ class String
4
+ # Wraps a string by inserting line breaks at a specified line width.
5
+ #
6
+ # @param line_width [Numeric]
7
+ # @param break_sequence [String]
8
+ # @param return_type [String] 'string' or 'array'
9
+ #
10
+ # @return [String, Array<String>]
11
+ #
12
+ def word_wrap(line_width: 80, break_sequence: "\n", return_type: 'string')
13
+ results =
14
+ split("\n").map! do |line|
15
+ (line.length > line_width) ? line.gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1#{break_sequence}").strip : line
16
+ end
17
+
18
+ results *= break_sequence
19
+
20
+ # Special case for returning an array of the results
21
+ if return_type.to_s == 'array'
22
+ return results.split(break_sequence)
23
+ end
24
+
25
+ results
26
+ end
27
+ end
@@ -1,5 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyRailsExtensions
4
- VERSION = '2.2.0'
4
+ module VERSION
5
+ MAJOR = 2
6
+ MINOR = 3
7
+ TINY = 0
8
+
9
+ # Set PRE to nil unless it's a pre-release (beta, rc, etc.)
10
+ PRE = 'rc.pre.1'
11
+
12
+ STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.').freeze
13
+
14
+ # @return [String]
15
+ def self.to_s
16
+ STRING
17
+ end
18
+ end
5
19
  end
@@ -77,6 +77,7 @@ module RubyRailsExtensions
77
77
  usd_to_i
78
78
  utf8_encode
79
79
  weighted_sum
80
+ word_wrap
80
81
  yesno
81
82
  zero_range
82
83
  ].freeze
@@ -124,6 +125,15 @@ module RubyRailsExtensions
124
125
 
125
126
  module_function
126
127
 
128
+ # Returns RubyRailsExtensions' `::Gem::Version`, convenient for comparisons. This is
129
+ # recommended over `::RubyRailsExtensions::VERSION::STRING`.
130
+ #
131
+ # @api public
132
+ #
133
+ def gem_version
134
+ ::Gem::Version.new(VERSION::STRING)
135
+ end
136
+
127
137
  # @return [Configuration]
128
138
  def configuration
129
139
  @configuration ||= Configuration.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-rails-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0.rc.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brands Insurance
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-07-29 00:00:00.000000000 Z
11
+ date: 2025-12-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email:
@@ -91,6 +91,7 @@ files:
91
91
  - lib/ruby-rails-extensions/extensions/usd_to_i.rb
92
92
  - lib/ruby-rails-extensions/extensions/utf8_encode.rb
93
93
  - lib/ruby-rails-extensions/extensions/weighted_sum.rb
94
+ - lib/ruby-rails-extensions/extensions/word_wrap.rb
94
95
  - lib/ruby-rails-extensions/extensions/yesno.rb
95
96
  - lib/ruby-rails-extensions/extensions/zero_range.rb
96
97
  - lib/ruby-rails-extensions/version.rb
@@ -111,9 +112,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
111
112
  version: 3.0.1
112
113
  required_rubygems_version: !ruby/object:Gem::Requirement
113
114
  requirements:
114
- - - ">="
115
+ - - ">"
115
116
  - !ruby/object:Gem::Version
116
- version: '0'
117
+ version: 1.3.1
117
118
  requirements: []
118
119
  rubygems_version: 3.2.15
119
120
  signing_key: