rbs 3.0.0.dev.2 → 3.0.0.dev.3
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/.github/workflows/comments.yml +2 -1
- data/.github/workflows/ruby.yml +4 -0
- data/Gemfile.lock +11 -11
- data/Rakefile +2 -2
- data/Steepfile +1 -1
- data/core/array.rbs +573 -423
- data/core/basic_object.rbs +11 -39
- data/core/binding.rbs +1 -1
- data/core/builtin.rbs +8 -0
- data/core/class.rbs +37 -0
- data/core/comparable.rbs +7 -18
- data/core/complex.rbs +2 -2
- data/core/data.rbs +419 -0
- data/core/dir.rbs +52 -104
- data/core/encoding.rbs +22 -181
- data/core/enumerable.rbs +212 -175
- data/core/enumerator/product.rbs +96 -0
- data/core/enumerator.rbs +57 -8
- data/core/errors.rbs +8 -2
- data/core/exception.rbs +41 -0
- data/core/fiber.rbs +95 -12
- data/core/file.rbs +840 -275
- data/core/file_test.rbs +34 -19
- data/core/float.rbs +40 -96
- data/core/gc.rbs +15 -3
- data/core/hash.rbs +113 -175
- data/core/integer.rbs +85 -145
- data/core/io/buffer.rbs +187 -60
- data/core/io/wait.rbs +28 -16
- data/core/io.rbs +1859 -1389
- data/core/kernel.rbs +525 -961
- data/core/match_data.rbs +306 -142
- data/core/math.rbs +506 -234
- data/core/method.rbs +0 -24
- data/core/module.rbs +110 -17
- data/core/nil_class.rbs +2 -0
- data/core/numeric.rbs +76 -144
- data/core/object.rbs +88 -212
- data/core/proc.rbs +17 -5
- data/core/process.rbs +22 -5
- data/core/ractor.rbs +1 -1
- data/core/random.rbs +20 -3
- data/core/range.rbs +91 -89
- data/core/rational.rbs +2 -3
- data/core/rbs/unnamed/argf.rbs +177 -120
- data/core/rbs/unnamed/env_class.rbs +89 -163
- data/core/rbs/unnamed/random.rbs +36 -12
- data/core/refinement.rbs +8 -0
- data/core/regexp.rbs +462 -272
- data/core/ruby_vm.rbs +210 -0
- data/{stdlib/set/0 → core}/set.rbs +43 -47
- data/core/string.rbs +1403 -1332
- data/core/string_io.rbs +191 -107
- data/core/struct.rbs +67 -63
- data/core/symbol.rbs +187 -201
- data/core/thread.rbs +40 -35
- data/core/time.rbs +902 -826
- data/core/trace_point.rbs +55 -6
- data/core/unbound_method.rbs +48 -24
- data/docs/collection.md +4 -0
- data/docs/syntax.md +55 -0
- data/ext/rbs_extension/parser.c +5 -6
- data/lib/rbs/cli.rb +6 -1
- data/lib/rbs/collection/cleaner.rb +8 -1
- data/lib/rbs/collection/config/lockfile.rb +3 -1
- data/lib/rbs/collection/config/lockfile_generator.rb +16 -14
- data/lib/rbs/collection/config.rb +1 -1
- data/lib/rbs/collection/sources/git.rb +9 -2
- data/lib/rbs/collection/sources/local.rb +79 -0
- data/lib/rbs/collection/sources.rb +8 -1
- data/lib/rbs/environment.rb +6 -5
- data/lib/rbs/environment_loader.rb +3 -2
- data/lib/rbs/errors.rb +18 -0
- data/lib/rbs/locator.rb +26 -7
- data/lib/rbs/sorter.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/sig/collection/sources.rbs +32 -3
- data/sig/environment.rbs +2 -3
- data/sig/locator.rbs +14 -2
- data/sig/shims/{abstract_syntax_tree.rbs → _abstract_syntax_tree.rbs} +0 -0
- data/stdlib/bigdecimal/0/big_decimal.rbs +16 -13
- data/stdlib/cgi/0/core.rbs +16 -0
- data/stdlib/coverage/0/coverage.rbs +50 -8
- data/stdlib/csv/0/csv.rbs +1 -1
- data/stdlib/date/0/date.rbs +856 -726
- data/stdlib/date/0/date_time.rbs +83 -210
- data/stdlib/erb/0/erb.rbs +13 -36
- data/stdlib/etc/0/etc.rbs +127 -20
- data/stdlib/fileutils/0/fileutils.rbs +1290 -381
- data/stdlib/logger/0/logger.rbs +466 -316
- data/stdlib/net-http/0/net-http.rbs +2211 -534
- data/stdlib/nkf/0/nkf.rbs +5 -5
- data/stdlib/objspace/0/objspace.rbs +31 -14
- data/stdlib/openssl/0/openssl.rbs +11 -7
- data/stdlib/optparse/0/optparse.rbs +20 -17
- data/stdlib/pathname/0/pathname.rbs +21 -4
- data/stdlib/pstore/0/pstore.rbs +378 -154
- data/stdlib/pty/0/pty.rbs +24 -8
- data/stdlib/ripper/0/ripper.rbs +1650 -0
- data/stdlib/socket/0/addrinfo.rbs +9 -15
- data/stdlib/socket/0/socket.rbs +36 -3
- data/stdlib/strscan/0/string_scanner.rbs +7 -5
- data/stdlib/tempfile/0/tempfile.rbs +104 -44
- data/stdlib/time/0/time.rbs +2 -2
- data/stdlib/uri/0/file.rbs +5 -0
- data/stdlib/uri/0/generic.rbs +2 -2
- data/stdlib/yaml/0/yaml.rbs +2 -2
- data/stdlib/zlib/0/zlib.rbs +1 -1
- metadata +8 -6
- data/core/deprecated.rbs +0 -9
- data/sig/shims/ripper.rbs +0 -8
data/stdlib/date/0/date_time.rbs
CHANGED
|
@@ -133,16 +133,9 @@
|
|
|
133
133
|
class DateTime < Date
|
|
134
134
|
# <!--
|
|
135
135
|
# rdoc-file=ext/date/date_core.c
|
|
136
|
-
# -
|
|
137
|
-
# - DateTime.new([year=-4712[, month=1[, mday=1[, hour=0[, minute=0[, second=0[, offset=0[, start=Date::ITALY]]]]]]]]) -> datetime
|
|
136
|
+
# - new(*args)
|
|
138
137
|
# -->
|
|
139
|
-
#
|
|
140
|
-
#
|
|
141
|
-
# DateTime.new(2001,2,3) #=> #<DateTime: 2001-02-03T00:00:00+00:00 ...>
|
|
142
|
-
# DateTime.new(2001,2,3,4,5,6,'+7')
|
|
143
|
-
# #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
|
144
|
-
# DateTime.new(2001,-11,-26,-20,-55,-54,'+7')
|
|
145
|
-
# #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
|
138
|
+
# Same as DateTime.new.
|
|
146
139
|
#
|
|
147
140
|
def initialize: (?Integer year, ?Integer month, ?Integer mday, ?Integer hour, ?Integer minute, ?Integer second, ?Integer offset, ?Integer start) -> void
|
|
148
141
|
|
|
@@ -160,16 +153,9 @@ class DateTime < Date
|
|
|
160
153
|
|
|
161
154
|
# <!--
|
|
162
155
|
# rdoc-file=ext/date/date_core.c
|
|
163
|
-
# -
|
|
164
|
-
# - DateTime.new([year=-4712[, month=1[, mday=1[, hour=0[, minute=0[, second=0[, offset=0[, start=Date::ITALY]]]]]]]]) -> datetime
|
|
156
|
+
# - civil(*args)
|
|
165
157
|
# -->
|
|
166
|
-
#
|
|
167
|
-
#
|
|
168
|
-
# DateTime.new(2001,2,3) #=> #<DateTime: 2001-02-03T00:00:00+00:00 ...>
|
|
169
|
-
# DateTime.new(2001,2,3,4,5,6,'+7')
|
|
170
|
-
# #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
|
171
|
-
# DateTime.new(2001,-11,-26,-20,-55,-54,'+7')
|
|
172
|
-
# #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
|
|
158
|
+
# Same as DateTime.new.
|
|
173
159
|
#
|
|
174
160
|
def self.civil: (?Integer year, ?Integer month, ?Integer mday, ?Integer hour, ?Integer minute, ?Integer second, ?Integer offset, ?Integer start) -> DateTime
|
|
175
161
|
|
|
@@ -287,9 +273,9 @@ class DateTime < Date
|
|
|
287
273
|
# Parses the given representation of date and time, and creates a DateTime
|
|
288
274
|
# object.
|
|
289
275
|
#
|
|
290
|
-
# This method
|
|
291
|
-
# match valid formats strictly, you may get a cryptic result. Should
|
|
292
|
-
# to use
|
|
276
|
+
# This method **does** **not** function as a validator. If the input string
|
|
277
|
+
# does not match valid formats strictly, you may get a cryptic result. Should
|
|
278
|
+
# consider to use DateTime.strptime instead of this method as possible.
|
|
293
279
|
#
|
|
294
280
|
# If the optional second argument is true and the detected year is in the range
|
|
295
281
|
# "00" to "99", makes it full.
|
|
@@ -406,11 +392,46 @@ class DateTime < Date
|
|
|
406
392
|
|
|
407
393
|
# <!--
|
|
408
394
|
# rdoc-file=ext/date/date_core.c
|
|
409
|
-
# -
|
|
395
|
+
# - deconstruct_keys(array_of_names_or_nil) -> hash
|
|
396
|
+
# -->
|
|
397
|
+
# Returns a hash of the name/value pairs, to use in pattern matching. Possible
|
|
398
|
+
# keys are: `:year`, `:month`, `:day`, `:wday`, `:yday`, `:hour`, `:min`,
|
|
399
|
+
# `:sec`, `:sec_fraction`, `:zone`.
|
|
400
|
+
#
|
|
401
|
+
# Possible usages:
|
|
402
|
+
#
|
|
403
|
+
# dt = DateTime.new(2022, 10, 5, 13, 30)
|
|
404
|
+
#
|
|
405
|
+
# if d in wday: 1..5, hour: 10..18 # uses deconstruct_keys underneath
|
|
406
|
+
# puts "Working time"
|
|
407
|
+
# end
|
|
408
|
+
# #=> prints "Working time"
|
|
409
|
+
#
|
|
410
|
+
# case dt
|
|
411
|
+
# in year: ...2022
|
|
412
|
+
# puts "too old"
|
|
413
|
+
# in month: ..9
|
|
414
|
+
# puts "quarter 1-3"
|
|
415
|
+
# in wday: 1..5, month:
|
|
416
|
+
# puts "working day in month #{month}"
|
|
417
|
+
# end
|
|
418
|
+
# #=> prints "working day in month 10"
|
|
419
|
+
#
|
|
420
|
+
# Note that deconstruction by pattern can also be combined with class check:
|
|
421
|
+
#
|
|
422
|
+
# if d in DateTime(wday: 1..5, hour: 10..18, day: ..7)
|
|
423
|
+
# puts "Working time, first week of the month"
|
|
424
|
+
# end
|
|
425
|
+
#
|
|
426
|
+
def deconstruct_keys: (Array[Symbol]?) -> Hash[Symbol, untyped]
|
|
427
|
+
|
|
428
|
+
# <!--
|
|
429
|
+
# rdoc-file=ext/date/date_core.c
|
|
430
|
+
# - hour -> integer
|
|
410
431
|
# -->
|
|
411
|
-
# Returns the hour (0
|
|
432
|
+
# Returns the hour in range (0..23):
|
|
412
433
|
#
|
|
413
|
-
# DateTime.new(2001,2,3,4,5,6).hour
|
|
434
|
+
# DateTime.new(2001, 2, 3, 4, 5, 6).hour # => 4
|
|
414
435
|
#
|
|
415
436
|
def hour: () -> Integer
|
|
416
437
|
|
|
@@ -441,19 +462,22 @@ class DateTime < Date
|
|
|
441
462
|
|
|
442
463
|
# <!--
|
|
443
464
|
# rdoc-file=ext/date/date_core.c
|
|
444
|
-
# -
|
|
445
|
-
# - d.minute -> fixnum
|
|
465
|
+
# - min -> integer
|
|
446
466
|
# -->
|
|
447
|
-
# Returns the minute (0
|
|
467
|
+
# Returns the minute in range (0..59):
|
|
448
468
|
#
|
|
449
|
-
# DateTime.new(2001,2,3,4,5,6).min
|
|
469
|
+
# DateTime.new(2001, 2, 3, 4, 5, 6).min # => 5
|
|
470
|
+
#
|
|
471
|
+
# Date#minute is an alias for Date#min.
|
|
450
472
|
#
|
|
451
473
|
def min: () -> Integer
|
|
452
474
|
|
|
453
475
|
# <!-- rdoc-file=ext/date/date_core.c -->
|
|
454
|
-
# Returns the minute (0
|
|
476
|
+
# Returns the minute in range (0..59):
|
|
477
|
+
#
|
|
478
|
+
# DateTime.new(2001, 2, 3, 4, 5, 6).min # => 5
|
|
455
479
|
#
|
|
456
|
-
#
|
|
480
|
+
# Date#minute is an alias for Date#min.
|
|
457
481
|
#
|
|
458
482
|
def minute: () -> Integer
|
|
459
483
|
|
|
@@ -493,210 +517,59 @@ class DateTime < Date
|
|
|
493
517
|
|
|
494
518
|
# <!--
|
|
495
519
|
# rdoc-file=ext/date/date_core.c
|
|
496
|
-
# -
|
|
497
|
-
# - d.second -> fixnum
|
|
520
|
+
# - sec -> integer
|
|
498
521
|
# -->
|
|
499
|
-
# Returns the second (0
|
|
522
|
+
# Returns the second in range (0..59):
|
|
523
|
+
#
|
|
524
|
+
# DateTime.new(2001, 2, 3, 4, 5, 6).sec # => 6
|
|
500
525
|
#
|
|
501
|
-
#
|
|
526
|
+
# Date#second is an alias for Date#sec.
|
|
502
527
|
#
|
|
503
528
|
def sec: () -> Integer
|
|
504
529
|
|
|
505
530
|
# <!--
|
|
506
531
|
# rdoc-file=ext/date/date_core.c
|
|
507
|
-
# -
|
|
508
|
-
# - d.second_fraction -> rational
|
|
532
|
+
# - sec_fraction -> rational
|
|
509
533
|
# -->
|
|
510
|
-
# Returns the fractional part of the second
|
|
534
|
+
# Returns the fractional part of the second in range (Rational(0,
|
|
535
|
+
# 1)...Rational(1, 1)):
|
|
511
536
|
#
|
|
512
|
-
# DateTime.new(2001,2,3,4,5,6.5).sec_fraction
|
|
537
|
+
# DateTime.new(2001, 2, 3, 4, 5, 6.5).sec_fraction # => (1/2)
|
|
538
|
+
#
|
|
539
|
+
# Date#second_fraction is an alias for Date#sec_fraction.
|
|
513
540
|
#
|
|
514
541
|
def sec_fraction: () -> Rational
|
|
515
542
|
|
|
516
543
|
# <!-- rdoc-file=ext/date/date_core.c -->
|
|
517
|
-
# Returns the second (0
|
|
544
|
+
# Returns the second in range (0..59):
|
|
545
|
+
#
|
|
546
|
+
# DateTime.new(2001, 2, 3, 4, 5, 6).sec # => 6
|
|
518
547
|
#
|
|
519
|
-
#
|
|
548
|
+
# Date#second is an alias for Date#sec.
|
|
520
549
|
#
|
|
521
550
|
def second: () -> Integer
|
|
522
551
|
|
|
523
552
|
# <!-- rdoc-file=ext/date/date_core.c -->
|
|
524
|
-
# Returns the fractional part of the second
|
|
553
|
+
# Returns the fractional part of the second in range (Rational(0,
|
|
554
|
+
# 1)...Rational(1, 1)):
|
|
555
|
+
#
|
|
556
|
+
# DateTime.new(2001, 2, 3, 4, 5, 6.5).sec_fraction # => (1/2)
|
|
525
557
|
#
|
|
526
|
-
#
|
|
558
|
+
# Date#second_fraction is an alias for Date#sec_fraction.
|
|
527
559
|
#
|
|
528
560
|
def second_fraction: () -> Rational
|
|
529
561
|
|
|
530
562
|
# <!--
|
|
531
563
|
# rdoc-file=ext/date/date_core.c
|
|
532
|
-
# -
|
|
533
|
-
# -->
|
|
534
|
-
#
|
|
535
|
-
#
|
|
536
|
-
#
|
|
537
|
-
#
|
|
538
|
-
#
|
|
539
|
-
#
|
|
540
|
-
#
|
|
541
|
-
#
|
|
542
|
-
# %<flags><width><modifier><conversion>
|
|
543
|
-
#
|
|
544
|
-
# Flags:
|
|
545
|
-
# - don't pad a numerical output.
|
|
546
|
-
# _ use spaces for padding.
|
|
547
|
-
# 0 use zeros for padding.
|
|
548
|
-
# ^ upcase the result string.
|
|
549
|
-
# # change case.
|
|
550
|
-
# : use colons for %z.
|
|
551
|
-
#
|
|
552
|
-
# The minimum field width specifies the minimum width.
|
|
553
|
-
#
|
|
554
|
-
# The modifiers are "E" and "O". They are ignored.
|
|
555
|
-
#
|
|
556
|
-
# Format directives:
|
|
557
|
-
#
|
|
558
|
-
# Date (Year, Month, Day):
|
|
559
|
-
# %Y - Year with century (can be negative, 4 digits at least)
|
|
560
|
-
# -0001, 0000, 1995, 2009, 14292, etc.
|
|
561
|
-
# %C - year / 100 (round down. 20 in 2009)
|
|
562
|
-
# %y - year % 100 (00..99)
|
|
563
|
-
#
|
|
564
|
-
# %m - Month of the year, zero-padded (01..12)
|
|
565
|
-
# %_m blank-padded ( 1..12)
|
|
566
|
-
# %-m no-padded (1..12)
|
|
567
|
-
# %B - The full month name (``January'')
|
|
568
|
-
# %^B uppercased (``JANUARY'')
|
|
569
|
-
# %b - The abbreviated month name (``Jan'')
|
|
570
|
-
# %^b uppercased (``JAN'')
|
|
571
|
-
# %h - Equivalent to %b
|
|
572
|
-
#
|
|
573
|
-
# %d - Day of the month, zero-padded (01..31)
|
|
574
|
-
# %-d no-padded (1..31)
|
|
575
|
-
# %e - Day of the month, blank-padded ( 1..31)
|
|
576
|
-
#
|
|
577
|
-
# %j - Day of the year (001..366)
|
|
578
|
-
#
|
|
579
|
-
# Time (Hour, Minute, Second, Subsecond):
|
|
580
|
-
# %H - Hour of the day, 24-hour clock, zero-padded (00..23)
|
|
581
|
-
# %k - Hour of the day, 24-hour clock, blank-padded ( 0..23)
|
|
582
|
-
# %I - Hour of the day, 12-hour clock, zero-padded (01..12)
|
|
583
|
-
# %l - Hour of the day, 12-hour clock, blank-padded ( 1..12)
|
|
584
|
-
# %P - Meridian indicator, lowercase (``am'' or ``pm'')
|
|
585
|
-
# %p - Meridian indicator, uppercase (``AM'' or ``PM'')
|
|
586
|
-
#
|
|
587
|
-
# %M - Minute of the hour (00..59)
|
|
588
|
-
#
|
|
589
|
-
# %S - Second of the minute (00..60)
|
|
590
|
-
#
|
|
591
|
-
# %L - Millisecond of the second (000..999)
|
|
592
|
-
# %N - Fractional seconds digits, default is 9 digits (nanosecond)
|
|
593
|
-
# %3N millisecond (3 digits) %15N femtosecond (15 digits)
|
|
594
|
-
# %6N microsecond (6 digits) %18N attosecond (18 digits)
|
|
595
|
-
# %9N nanosecond (9 digits) %21N zeptosecond (21 digits)
|
|
596
|
-
# %12N picosecond (12 digits) %24N yoctosecond (24 digits)
|
|
597
|
-
#
|
|
598
|
-
# Time zone:
|
|
599
|
-
# %z - Time zone as hour and minute offset from UTC (e.g. +0900)
|
|
600
|
-
# %:z - hour and minute offset from UTC with a colon (e.g. +09:00)
|
|
601
|
-
# %::z - hour, minute and second offset from UTC (e.g. +09:00:00)
|
|
602
|
-
# %:::z - hour, minute and second offset from UTC
|
|
603
|
-
# (e.g. +09, +09:30, +09:30:30)
|
|
604
|
-
# %Z - Equivalent to %:z (e.g. +09:00)
|
|
605
|
-
#
|
|
606
|
-
# Weekday:
|
|
607
|
-
# %A - The full weekday name (``Sunday'')
|
|
608
|
-
# %^A uppercased (``SUNDAY'')
|
|
609
|
-
# %a - The abbreviated name (``Sun'')
|
|
610
|
-
# %^a uppercased (``SUN'')
|
|
611
|
-
# %u - Day of the week (Monday is 1, 1..7)
|
|
612
|
-
# %w - Day of the week (Sunday is 0, 0..6)
|
|
613
|
-
#
|
|
614
|
-
# ISO 8601 week-based year and week number:
|
|
615
|
-
# The week 1 of YYYY starts with a Monday and includes YYYY-01-04.
|
|
616
|
-
# The days in the year before the first week are in the last week of
|
|
617
|
-
# the previous year.
|
|
618
|
-
# %G - The week-based year
|
|
619
|
-
# %g - The last 2 digits of the week-based year (00..99)
|
|
620
|
-
# %V - Week number of the week-based year (01..53)
|
|
621
|
-
#
|
|
622
|
-
# Week number:
|
|
623
|
-
# The week 1 of YYYY starts with a Sunday or Monday (according to %U
|
|
624
|
-
# or %W). The days in the year before the first week are in week 0.
|
|
625
|
-
# %U - Week number of the year. The week starts with Sunday. (00..53)
|
|
626
|
-
# %W - Week number of the year. The week starts with Monday. (00..53)
|
|
627
|
-
#
|
|
628
|
-
# Seconds since the Unix Epoch:
|
|
629
|
-
# %s - Number of seconds since 1970-01-01 00:00:00 UTC.
|
|
630
|
-
# %Q - Number of milliseconds since 1970-01-01 00:00:00 UTC.
|
|
631
|
-
#
|
|
632
|
-
# Literal string:
|
|
633
|
-
# %n - Newline character (\n)
|
|
634
|
-
# %t - Tab character (\t)
|
|
635
|
-
# %% - Literal ``%'' character
|
|
636
|
-
#
|
|
637
|
-
# Combination:
|
|
638
|
-
# %c - date and time (%a %b %e %T %Y)
|
|
639
|
-
# %D - Date (%m/%d/%y)
|
|
640
|
-
# %F - The ISO 8601 date format (%Y-%m-%d)
|
|
641
|
-
# %v - VMS date (%e-%^b-%Y)
|
|
642
|
-
# %x - Same as %D
|
|
643
|
-
# %X - Same as %T
|
|
644
|
-
# %r - 12-hour time (%I:%M:%S %p)
|
|
645
|
-
# %R - 24-hour time (%H:%M)
|
|
646
|
-
# %T - 24-hour time (%H:%M:%S)
|
|
647
|
-
# %+ - date(1) (%a %b %e %H:%M:%S %Z %Y)
|
|
648
|
-
#
|
|
649
|
-
# This method is similar to the strftime() function defined in ISO C and POSIX.
|
|
650
|
-
# Several directives (%a, %A, %b, %B, %c, %p, %r, %x, %X, %E*, %O* and %Z) are
|
|
651
|
-
# locale dependent in the function. However, this method is locale independent.
|
|
652
|
-
# So, the result may differ even if the same format string is used in other
|
|
653
|
-
# systems such as C. It is good practice to avoid %x and %X because there are
|
|
654
|
-
# corresponding locale independent representations, %D and %T.
|
|
655
|
-
#
|
|
656
|
-
# Examples:
|
|
657
|
-
#
|
|
658
|
-
# d = DateTime.new(2007,11,19,8,37,48,"-06:00")
|
|
659
|
-
# #=> #<DateTime: 2007-11-19T08:37:48-0600 ...>
|
|
660
|
-
# d.strftime("Printed on %m/%d/%Y") #=> "Printed on 11/19/2007"
|
|
661
|
-
# d.strftime("at %I:%M%p") #=> "at 08:37AM"
|
|
662
|
-
#
|
|
663
|
-
# Various ISO 8601 formats:
|
|
664
|
-
# %Y%m%d => 20071119 Calendar date (basic)
|
|
665
|
-
# %F => 2007-11-19 Calendar date (extended)
|
|
666
|
-
# %Y-%m => 2007-11 Calendar date, reduced accuracy, specific month
|
|
667
|
-
# %Y => 2007 Calendar date, reduced accuracy, specific year
|
|
668
|
-
# %C => 20 Calendar date, reduced accuracy, specific century
|
|
669
|
-
# %Y%j => 2007323 Ordinal date (basic)
|
|
670
|
-
# %Y-%j => 2007-323 Ordinal date (extended)
|
|
671
|
-
# %GW%V%u => 2007W471 Week date (basic)
|
|
672
|
-
# %G-W%V-%u => 2007-W47-1 Week date (extended)
|
|
673
|
-
# %GW%V => 2007W47 Week date, reduced accuracy, specific week (basic)
|
|
674
|
-
# %G-W%V => 2007-W47 Week date, reduced accuracy, specific week (extended)
|
|
675
|
-
# %H%M%S => 083748 Local time (basic)
|
|
676
|
-
# %T => 08:37:48 Local time (extended)
|
|
677
|
-
# %H%M => 0837 Local time, reduced accuracy, specific minute (basic)
|
|
678
|
-
# %H:%M => 08:37 Local time, reduced accuracy, specific minute (extended)
|
|
679
|
-
# %H => 08 Local time, reduced accuracy, specific hour
|
|
680
|
-
# %H%M%S,%L => 083748,000 Local time with decimal fraction, comma as decimal sign (basic)
|
|
681
|
-
# %T,%L => 08:37:48,000 Local time with decimal fraction, comma as decimal sign (extended)
|
|
682
|
-
# %H%M%S.%L => 083748.000 Local time with decimal fraction, full stop as decimal sign (basic)
|
|
683
|
-
# %T.%L => 08:37:48.000 Local time with decimal fraction, full stop as decimal sign (extended)
|
|
684
|
-
# %H%M%S%z => 083748-0600 Local time and the difference from UTC (basic)
|
|
685
|
-
# %T%:z => 08:37:48-06:00 Local time and the difference from UTC (extended)
|
|
686
|
-
# %Y%m%dT%H%M%S%z => 20071119T083748-0600 Date and time of day for calendar date (basic)
|
|
687
|
-
# %FT%T%:z => 2007-11-19T08:37:48-06:00 Date and time of day for calendar date (extended)
|
|
688
|
-
# %Y%jT%H%M%S%z => 2007323T083748-0600 Date and time of day for ordinal date (basic)
|
|
689
|
-
# %Y-%jT%T%:z => 2007-323T08:37:48-06:00 Date and time of day for ordinal date (extended)
|
|
690
|
-
# %GW%V%uT%H%M%S%z => 2007W471T083748-0600 Date and time of day for week date (basic)
|
|
691
|
-
# %G-W%V-%uT%T%:z => 2007-W47-1T08:37:48-06:00 Date and time of day for week date (extended)
|
|
692
|
-
# %Y%m%dT%H%M => 20071119T0837 Calendar date and local time (basic)
|
|
693
|
-
# %FT%R => 2007-11-19T08:37 Calendar date and local time (extended)
|
|
694
|
-
# %Y%jT%H%MZ => 2007323T0837Z Ordinal date and UTC of day (basic)
|
|
695
|
-
# %Y-%jT%RZ => 2007-323T08:37Z Ordinal date and UTC of day (extended)
|
|
696
|
-
# %GW%V%uT%H%M%z => 2007W471T0837-0600 Week date and local time and difference from UTC (basic)
|
|
697
|
-
# %G-W%V-%uT%R%:z => 2007-W47-1T08:37-06:00 Week date and local time and difference from UTC (extended)
|
|
698
|
-
#
|
|
699
|
-
# See also strftime(3) and ::strptime.
|
|
564
|
+
# - strftime(format = '%FT%T%:z') -> string
|
|
565
|
+
# -->
|
|
566
|
+
# Returns a string representation of `self`, formatted according the given
|
|
567
|
+
# +format:
|
|
568
|
+
#
|
|
569
|
+
# DateTime.now.strftime # => "2022-07-01T11:03:19-05:00"
|
|
570
|
+
#
|
|
571
|
+
# For other formats, see [Formats for Dates and
|
|
572
|
+
# Times](doc/strftime_formatting.rdoc).
|
|
700
573
|
#
|
|
701
574
|
def strftime: (?String format) -> String
|
|
702
575
|
|
data/stdlib/erb/0/erb.rbs
CHANGED
|
@@ -447,9 +447,6 @@ class ERB
|
|
|
447
447
|
#
|
|
448
448
|
def def_class: (?Class, ?String) -> Class
|
|
449
449
|
|
|
450
|
-
# <!-- rdoc-file=lib/erb.rb -->
|
|
451
|
-
# A utility module for conversion routines, often handy in HTML generation.
|
|
452
|
-
#
|
|
453
450
|
module Util
|
|
454
451
|
# <!--
|
|
455
452
|
# rdoc-file=lib/erb.rb
|
|
@@ -483,7 +480,7 @@ class ERB
|
|
|
483
480
|
alias self.h self.html_escape
|
|
484
481
|
|
|
485
482
|
# <!--
|
|
486
|
-
# rdoc-file=lib/erb.rb
|
|
483
|
+
# rdoc-file=lib/erb/util.rb
|
|
487
484
|
# - url_encode(s)
|
|
488
485
|
# -->
|
|
489
486
|
# A utility method for encoding the String *s* as a URL.
|
|
@@ -500,52 +497,23 @@ class ERB
|
|
|
500
497
|
def self?.url_encode: (String) -> String
|
|
501
498
|
|
|
502
499
|
# <!--
|
|
503
|
-
# rdoc-file=lib/erb.rb
|
|
500
|
+
# rdoc-file=lib/erb/util.rb
|
|
504
501
|
# - u(s)
|
|
505
502
|
# -->
|
|
506
503
|
#
|
|
507
504
|
alias u url_encode
|
|
508
505
|
|
|
509
506
|
# <!--
|
|
510
|
-
# rdoc-file=lib/erb.rb
|
|
507
|
+
# rdoc-file=lib/erb/util.rb
|
|
511
508
|
# - u(s)
|
|
512
509
|
# -->
|
|
513
510
|
#
|
|
514
511
|
alias self.u self.url_encode
|
|
515
512
|
end
|
|
516
513
|
|
|
517
|
-
# <!-- rdoc-file=lib/erb.rb -->
|
|
518
|
-
# Utility module to define eRuby script as instance method.
|
|
519
|
-
#
|
|
520
|
-
# ### Example
|
|
521
|
-
#
|
|
522
|
-
# example.rhtml:
|
|
523
|
-
# <% for item in @items %>
|
|
524
|
-
# <b><%= item %></b>
|
|
525
|
-
# <% end %>
|
|
526
|
-
#
|
|
527
|
-
# example.rb:
|
|
528
|
-
# require 'erb'
|
|
529
|
-
# class MyClass
|
|
530
|
-
# extend ERB::DefMethod
|
|
531
|
-
# def_erb_method('render()', 'example.rhtml')
|
|
532
|
-
# def initialize(items)
|
|
533
|
-
# @items = items
|
|
534
|
-
# end
|
|
535
|
-
# end
|
|
536
|
-
# print MyClass.new([10,20,30]).render()
|
|
537
|
-
#
|
|
538
|
-
# result:
|
|
539
|
-
#
|
|
540
|
-
# <b>10</b>
|
|
541
|
-
#
|
|
542
|
-
# <b>20</b>
|
|
543
|
-
#
|
|
544
|
-
# <b>30</b>
|
|
545
|
-
#
|
|
546
514
|
module DefMethod
|
|
547
515
|
# <!--
|
|
548
|
-
# rdoc-file=lib/erb.rb
|
|
516
|
+
# rdoc-file=lib/erb/def_method.rb
|
|
549
517
|
# - def_erb_method(methodname, erb_or_fname)
|
|
550
518
|
# -->
|
|
551
519
|
# define *methodname* as instance method of current module, using ERB object or
|
|
@@ -553,4 +521,13 @@ class ERB
|
|
|
553
521
|
#
|
|
554
522
|
def self.def_erb_method: (String methodname, (String | ERB) erb_or_fname) -> untyped
|
|
555
523
|
end
|
|
524
|
+
|
|
525
|
+
module Escape
|
|
526
|
+
# <!--
|
|
527
|
+
# rdoc-file=lib/erb/util.rb
|
|
528
|
+
# - html_escape(s)
|
|
529
|
+
# -->
|
|
530
|
+
#
|
|
531
|
+
def self?.html_escape: (String) -> String
|
|
532
|
+
end
|
|
556
533
|
end
|