[#92891] Question: ruby 2.7.0-preview1 also upgrades bundler to 2.1.0.pre.1? — Al Snow <jasnow@...>
Tried the new 2.7.0-preview1 upgrade to Ruby and see that bundler is also upgraded (to 2.1.0.pre.1).
5 messages
2019/05/30
[#92892] Re: Question: ruby 2.7.0-preview1 also upgrades bundler to 2.1.0.pre.1?
— SHIBATA Hiroshi <hsbt@...>
2019/05/30
Bundler 2.1.0.pree.1 is the expected version.
[ruby-core:92859] [Ruby trunk Feature#15879] Proposal: Time#to_i accepts :unit keyword
From:
sawadatsuyoshi@...
Date:
2019-05-27 10:10:26 UTC
List:
ruby-core #92859
Issue #15879 has been updated by sawa (Tsuyoshi Sawada).
By analogy from `Time#round`, which takes as an argument an integer representing the precision in decimal places, and from `String#to_i`, which takes an integer, I think that passing an integer representing the number of decimal places would fit better. Something like this:
```ruby
{
event_id: id,
name: name,
tracked_at: tracked_at.to_i(3),
tracked_at_micro: tracked_at.to_i(6)
}
```
Default would be `0`.
----------------------------------------
Feature #15879: Proposal: Time#to_i accepts :unit keyword
https://bugs.ruby-lang.org/issues/15879#change-78240
* Author: joker1007 (Tomohiro Hashidate)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
I often need Unix time as microseconds or nanoseconds to serialize for other language environments.
For example, Java uses milliseconds(nanoseconds) basically.
In such a situation, current Ruby code is like below.
``` ruby
{
event_id: id,
name: name,
tracked_at: (tracked_at.to_f * 1000).round,
tracked_at_micro: (tracked_at * 1000000 + tracked_at.usec)
}
```
But this example is noisy. And it is easy to make a mistake.
I want to write like below.
```ruby
{
event_id: id,
name: name,
tracked_at: tracked_at.to_i(unit: :milli),
tracked_at_micro: tracked_at.to_i(unit: :micro)
}
# or
{
event_id: id,
name: name,
tracked_at: tracked_at.as_msec,
tracked_at_micro: tracked_at.as_usec
}
```
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>