ml.ruby-lang.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

ruby-core

Thread Start a new thread
Download
Threads by month
  • ----- 2025 -----
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
ruby-core@ml.ruby-lang.org

January 2023

  • 6 participants
  • 252 discussions
[ruby-core:111560] [Ruby master Feature#3591] Adding Numeric#divisor? (Have working implementation)
by e8c (Viktor Reznov) 01 Jan '23

01 Jan '23
Issue #3591 has been updated by e8c (Viktor Reznov). matz (Yukihiro Matsumoto) wrote in #note-19: > Is it more useful than `n % m == 0`? Yes, statement `n .has_divisor? m` (or `m .divisor_of? n`) has 3 parts instead of 5, and gives a direct answer to the question. The "problem": https://leetcode.com/problems/count-the-digits-that-divide-a-number/ Two solutions: ```ruby def count_digits(n) = n.digits.count { n % _1 == 0 } def count_digits(n) = n.digits.count { _1.divisor_of?(n) } ``` The first is shorter, but the second is clearer. ---------------------------------------- Feature #3591: Adding Numeric#divisor? (Have working implementation) https://bugs.ruby-lang.org/issues/3591#change-100925 * Author: duckinator (Marie Markwell) * Status: Rejected * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) * Target version: 2.6 ---------------------------------------- =begin On the 'duckinator' branch of my fork of ruby on github, I have added Numeric#divisor?: num.divisor?(other) is the same as: (num % other == 0) Example usage: 4.divisor?(2) #=> true 1.divisor?(2) #=> false 2.4.divisor?(1.2) #=> true 2.4.divisor?(1.3) #=> false 126.divisor?(9) #=> true I think this would be a very nice feature to add, and would make code using the old (num % other == 0) method much cleaner and easier to understand. There is a unified diff of it: http://gist.github.com/raw/484144/07b1a6e696cd9301e658ccbc8f90dfcd4d4ef3f1/… The original commits can be seen here: http://github.com/RockerMONO/ruby/commit/f7959f964cb0bf38418904ccb5643db6b6… -- First attempt, only worked with Integers http://github.com/RockerMONO/ruby/commit/12376a6bb1c3ffbd4b470850dd758e2dcd… -- Second attempt, should work with anything derived from Numeric that can be used as (num % other == 0) =end -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:111519] [Ruby master Bug#19285] (docs.rlo) Split stdlib and core documents
by zzak (Zak Scott) 01 Jan '23

01 Jan '23
Issue #19285 has been reported by zzak (Zak Scott). ---------------------------------------- Bug #19285: (docs.rlo) Split stdlib and core documents https://bugs.ruby-lang.org/issues/19285 * Author: zzak (Zak Scott) * Status: Open * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- It seems we merge all of the docs for stdlib and core into one for docs.ruby-lang.org, this creates weirdness like [Kernel](https://docs.ruby-lang.org/en/master/Kernel.html) which includes monkey patches for rubygems for example. > RubyGems adds the gem method to allow activation of specific gem versions and overrides the require method on Kernel to make gems appear as if they live on the $LOAD_PATH. See the documentation of these methods for further detail. -- https://bugs.ruby-lang.org/
2 1
0 0
  • ← Newer
  • 1
  • ...
  • 23
  • 24
  • 25
  • 26
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.