Skip to content

Commit fee4490

Browse files
committed
rbs collection update
1 parent 9ecd42f commit fee4490

File tree

20 files changed

+422
-179
lines changed

20 files changed

+422
-179
lines changed

.gem_rbs_collection/activesupport/7.0/.rbs_meta.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ version: '7.0'
44
source:
55
type: git
66
name: ruby/gem_rbs_collection
7-
revision: 0a6ea105a0afc7eaee4494585a7775f47eea6145
7+
revision: ccbd2bbc6be5c195df1d90aa68d64916a9e7d0ab
88
remote: https://github.com/ruby/gem_rbs_collection.git
99
repo_dir: gems

.gem_rbs_collection/activesupport/7.0/activesupport-7.0.rbs

+239
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,242 @@ end
138138
class String
139139
def downcase_first: () -> String
140140
end
141+
142+
# active_support/core_ext/array/conversions.rb
143+
class Array[unchecked out Elem]
144+
# Extends <tt>Array#to_s</tt> to convert a collection of elements into a
145+
# comma separated id list if <tt>:db</tt> argument is given as the format.
146+
#
147+
# This method is aliased to <tt>to_formatted_s</tt>.
148+
#
149+
# Blog.all.to_fs(:db) # => "1,2,3"
150+
# Blog.none.to_fs(:db) # => "null"
151+
# [1,2].to_fs # => "[1, 2]"
152+
def to_fs: (?Symbol format) -> String
153+
end
154+
155+
# active_support/core_ext/numeric/conversions.rb
156+
class Numeric
157+
# \Numeric With Format
158+
#
159+
# Provides options for converting numbers into formatted strings.
160+
# Options are provided for phone numbers, currency, percentage,
161+
# precision, positional notation, file size, and pretty printing.
162+
#
163+
# This method is aliased to <tt>to_formatted_s</tt>.
164+
#
165+
# ==== Options
166+
#
167+
# For details on which formats use which options, see ActiveSupport::NumberHelper
168+
#
169+
# ==== Examples
170+
#
171+
# Phone Numbers:
172+
# 5551234.to_fs(:phone) # => "555-1234"
173+
# 1235551234.to_fs(:phone) # => "123-555-1234"
174+
# 1235551234.to_fs(:phone, area_code: true) # => "(123) 555-1234"
175+
# 1235551234.to_fs(:phone, delimiter: ' ') # => "123 555 1234"
176+
# 1235551234.to_fs(:phone, area_code: true, extension: 555) # => "(123) 555-1234 x 555"
177+
# 1235551234.to_fs(:phone, country_code: 1) # => "+1-123-555-1234"
178+
# 1235551234.to_fs(:phone, country_code: 1, extension: 1343, delimiter: '.')
179+
# # => "+1.123.555.1234 x 1343"
180+
#
181+
# Currency:
182+
# 1234567890.50.to_fs(:currency) # => "$1,234,567,890.50"
183+
# 1234567890.506.to_fs(:currency) # => "$1,234,567,890.51"
184+
# 1234567890.506.to_fs(:currency, precision: 3) # => "$1,234,567,890.506"
185+
# 1234567890.506.to_fs(:currency, round_mode: :down) # => "$1,234,567,890.50"
186+
# 1234567890.506.to_fs(:currency, locale: :fr) # => "1 234 567 890,51 €"
187+
# -1234567890.50.to_fs(:currency, negative_format: '(%u%n)')
188+
# # => "($1,234,567,890.50)"
189+
# 1234567890.50.to_fs(:currency, unit: '&pound;', separator: ',', delimiter: '')
190+
# # => "&pound;1234567890,50"
191+
# 1234567890.50.to_fs(:currency, unit: '&pound;', separator: ',', delimiter: '', format: '%n %u')
192+
# # => "1234567890,50 &pound;"
193+
#
194+
# Percentage:
195+
# 100.to_fs(:percentage) # => "100.000%"
196+
# 100.to_fs(:percentage, precision: 0) # => "100%"
197+
# 1000.to_fs(:percentage, delimiter: '.', separator: ',') # => "1.000,000%"
198+
# 302.24398923423.to_fs(:percentage, precision: 5) # => "302.24399%"
199+
# 302.24398923423.to_fs(:percentage, round_mode: :down) # => "302.243%"
200+
# 1000.to_fs(:percentage, locale: :fr) # => "1 000,000%"
201+
# 100.to_fs(:percentage, format: '%n %') # => "100.000 %"
202+
#
203+
# Delimited:
204+
# 12345678.to_fs(:delimited) # => "12,345,678"
205+
# 12345678.05.to_fs(:delimited) # => "12,345,678.05"
206+
# 12345678.to_fs(:delimited, delimiter: '.') # => "12.345.678"
207+
# 12345678.to_fs(:delimited, delimiter: ',') # => "12,345,678"
208+
# 12345678.05.to_fs(:delimited, separator: ' ') # => "12,345,678 05"
209+
# 12345678.05.to_fs(:delimited, locale: :fr) # => "12 345 678,05"
210+
# 98765432.98.to_fs(:delimited, delimiter: ' ', separator: ',')
211+
# # => "98 765 432,98"
212+
#
213+
# Rounded:
214+
# 111.2345.to_fs(:rounded) # => "111.235"
215+
# 111.2345.to_fs(:rounded, precision: 2) # => "111.23"
216+
# 111.2345.to_fs(:rounded, precision: 2, round_mode: :up) # => "111.24"
217+
# 13.to_fs(:rounded, precision: 5) # => "13.00000"
218+
# 389.32314.to_fs(:rounded, precision: 0) # => "389"
219+
# 111.2345.to_fs(:rounded, significant: true) # => "111"
220+
# 111.2345.to_fs(:rounded, precision: 1, significant: true) # => "100"
221+
# 13.to_fs(:rounded, precision: 5, significant: true) # => "13.000"
222+
# 111.234.to_fs(:rounded, locale: :fr) # => "111,234"
223+
# 13.to_fs(:rounded, precision: 5, significant: true, strip_insignificant_zeros: true)
224+
# # => "13"
225+
# 389.32314.to_fs(:rounded, precision: 4, significant: true) # => "389.3"
226+
# 1111.2345.to_fs(:rounded, precision: 2, separator: ',', delimiter: '.')
227+
# # => "1.111,23"
228+
#
229+
# Human-friendly size in Bytes:
230+
# 123.to_fs(:human_size) # => "123 Bytes"
231+
# 1234.to_fs(:human_size) # => "1.21 KB"
232+
# 12345.to_fs(:human_size) # => "12.1 KB"
233+
# 1234567.to_fs(:human_size) # => "1.18 MB"
234+
# 1234567890.to_fs(:human_size) # => "1.15 GB"
235+
# 1234567890123.to_fs(:human_size) # => "1.12 TB"
236+
# 1234567890123456.to_fs(:human_size) # => "1.1 PB"
237+
# 1234567890123456789.to_fs(:human_size) # => "1.07 EB"
238+
# 1234567.to_fs(:human_size, precision: 2) # => "1.2 MB"
239+
# 1234567.to_fs(:human_size, precision: 2, round_mode: :up) # => "1.3 MB"
240+
# 483989.to_fs(:human_size, precision: 2) # => "470 KB"
241+
# 1234567.to_fs(:human_size, precision: 2, separator: ',') # => "1,2 MB"
242+
# 1234567890123.to_fs(:human_size, precision: 5) # => "1.1228 TB"
243+
# 524288000.to_fs(:human_size, precision: 5) # => "500 MB"
244+
#
245+
# Human-friendly format:
246+
# 123.to_fs(:human) # => "123"
247+
# 1234.to_fs(:human) # => "1.23 Thousand"
248+
# 12345.to_fs(:human) # => "12.3 Thousand"
249+
# 1234567.to_fs(:human) # => "1.23 Million"
250+
# 1234567890.to_fs(:human) # => "1.23 Billion"
251+
# 1234567890123.to_fs(:human) # => "1.23 Trillion"
252+
# 1234567890123456.to_fs(:human) # => "1.23 Quadrillion"
253+
# 1234567890123456789.to_fs(:human) # => "1230 Quadrillion"
254+
# 489939.to_fs(:human, precision: 2) # => "490 Thousand"
255+
# 489939.to_fs(:human, precision: 2, round_mode: :down) # => "480 Thousand"
256+
# 489939.to_fs(:human, precision: 4) # => "489.9 Thousand"
257+
# 1234567.to_fs(:human, precision: 4,
258+
# significant: false) # => "1.2346 Million"
259+
# 1234567.to_fs(:human, precision: 1,
260+
# separator: ',',
261+
# significant: false) # => "1,2 Million"
262+
def to_fs: (?Symbol format, **untyped) -> String
263+
end
264+
265+
# active_support/core_ext/range/conversions.rb
266+
class Range[out Elem]
267+
# Convert range to a formatted string. See RANGE_FORMATS for predefined formats.
268+
#
269+
# This method is aliased to <tt>to_formatted_s</tt>.
270+
#
271+
# range = (1..100) # => 1..100
272+
#
273+
# range.to_s # => "1..100"
274+
# range.to_fs(:db) # => "BETWEEN '1' AND '100'"
275+
#
276+
# range = (1..) # => 1..
277+
# range.to_fs(:db) # => ">= '1'"
278+
#
279+
# range = (..100) # => ..100
280+
# range.to_fs(:db) # => "<= '100'"
281+
#
282+
# == Adding your own range formats to to_fs
283+
# You can add your own formats to the Range::RANGE_FORMATS hash.
284+
# Use the format name as the hash key and a Proc instance.
285+
#
286+
# # config/initializers/range_formats.rb
287+
# Range::RANGE_FORMATS[:short] = ->(start, stop) { "Between #{start.to_fs(:db)} and #{stop.to_fs(:db)}" }
288+
def to_fs: (?Symbol format) -> String
289+
end
290+
291+
# active_support/core_ext/date/conversions.rb
292+
class Date
293+
# Convert to a formatted string. See DATE_FORMATS for predefined formats.
294+
#
295+
# This method is aliased to <tt>to_formatted_s</tt>.
296+
#
297+
# date = Date.new(2007, 11, 10) # => Sat, 10 Nov 2007
298+
#
299+
# date.to_fs(:db) # => "2007-11-10"
300+
# date.to_formatted_s(:db) # => "2007-11-10"
301+
#
302+
# date.to_fs(:short) # => "10 Nov"
303+
# date.to_fs(:number) # => "20071110"
304+
# date.to_fs(:long) # => "November 10, 2007"
305+
# date.to_fs(:long_ordinal) # => "November 10th, 2007"
306+
# date.to_fs(:rfc822) # => "10 Nov 2007"
307+
# date.to_fs(:iso8601) # => "2007-11-10"
308+
#
309+
# == Adding your own date formats to to_fs
310+
# You can add your own formats to the Date::DATE_FORMATS hash.
311+
# Use the format name as the hash key and either a strftime string
312+
# or Proc instance that takes a date argument as the value.
313+
#
314+
# # config/initializers/date_formats.rb
315+
# Date::DATE_FORMATS[:month_and_year] = '%B %Y'
316+
# Date::DATE_FORMATS[:short_ordinal] = ->(date) { date.strftime("%B #{date.day.ordinalize}") }
317+
def to_fs: (?Symbol format) -> String
318+
end
319+
320+
# active_support/core_ext/time/conversions.rb
321+
class Time
322+
# Converts to a formatted string. See DATE_FORMATS for built-in formats.
323+
#
324+
# This method is aliased to <tt>to_formatted_s</tt>.
325+
#
326+
# time = Time.now # => 2007-01-18 06:10:17 -06:00
327+
#
328+
# time.to_fs(:time) # => "06:10"
329+
# time.to_formatted_s(:time) # => "06:10"
330+
#
331+
# time.to_fs(:db) # => "2007-01-18 06:10:17"
332+
# time.to_fs(:number) # => "20070118061017"
333+
# time.to_fs(:short) # => "18 Jan 06:10"
334+
# time.to_fs(:long) # => "January 18, 2007 06:10"
335+
# time.to_fs(:long_ordinal) # => "January 18th, 2007 06:10"
336+
# time.to_fs(:rfc822) # => "Thu, 18 Jan 2007 06:10:17 -0600"
337+
# time.to_fs(:rfc2822) # => "Thu, 18 Jan 2007 06:10:17 -0600"
338+
# time.to_fs(:iso8601) # => "2007-01-18T06:10:17-06:00"
339+
#
340+
# == Adding your own time formats to +to_fs+
341+
# You can add your own formats to the Time::DATE_FORMATS hash.
342+
# Use the format name as the hash key and either a strftime string
343+
# or Proc instance that takes a time argument as the value.
344+
#
345+
# # config/initializers/time_formats.rb
346+
# Time::DATE_FORMATS[:month_and_year] = '%B %Y'
347+
# Time::DATE_FORMATS[:short_ordinal] = ->(time) { time.strftime("%B #{time.day.ordinalize}") }
348+
def to_fs: (?Symbol format) -> String
349+
end
350+
351+
# active_support/core_ext/date_time/conversions.rb
352+
class DateTime
353+
# Convert to a formatted string. See Time::DATE_FORMATS for predefined formats.
354+
#
355+
# This method is aliased to <tt>to_formatted_s</tt>.
356+
#
357+
# === Examples
358+
# datetime = DateTime.civil(2007, 12, 4, 0, 0, 0, 0) # => Tue, 04 Dec 2007 00:00:00 +0000
359+
#
360+
# datetime.to_fs(:db) # => "2007-12-04 00:00:00"
361+
# datetime.to_formatted_s(:db) # => "2007-12-04 00:00:00"
362+
# datetime.to_fs(:number) # => "20071204000000"
363+
# datetime.to_fs(:short) # => "04 Dec 00:00"
364+
# datetime.to_fs(:long) # => "December 04, 2007 00:00"
365+
# datetime.to_fs(:long_ordinal) # => "December 4th, 2007 00:00"
366+
# datetime.to_fs(:rfc822) # => "Tue, 04 Dec 2007 00:00:00 +0000"
367+
# datetime.to_fs(:iso8601) # => "2007-12-04T00:00:00+00:00"
368+
#
369+
# == Adding your own datetime formats to to_fs
370+
# DateTime formats are shared with Time. You can add your own to the
371+
# Time::DATE_FORMATS hash. Use the format name as the hash key and
372+
# either a strftime string or Proc instance that takes a time or
373+
# datetime argument as the value.
374+
#
375+
# # config/initializers/time_formats.rb
376+
# Time::DATE_FORMATS[:month_and_year] = '%B %Y'
377+
# Time::DATE_FORMATS[:short_ordinal] = lambda { |time| time.strftime("%B #{time.day.ordinalize}") }
378+
def to_fs: (?Symbol format) -> String
379+
end

0 commit comments

Comments
 (0)