[#74190] [Ruby trunk Feature#12134] Comparison between `true` and `false` — duerst@...
Issue #12134 has been updated by Martin D端rst.
3 messages
2016/03/07
[#74269] Type systems for Ruby — Rob Blanco <ml@...>
Dear ruby-core,
5 messages
2016/03/10
[#74395] [Ruby trunk Feature#12142] Hash tables with open addressing — shyouhei@...
Issue #12142 has been updated by Shyouhei Urabe.
3 messages
2016/03/17
[ruby-core:74583] [Ruby trunk Feature#12211] introduce Date#first_of_month and Date#last_of_month
From:
arai@...
Date:
2016-03-26 00:58:21 UTC
List:
ruby-core #74583
Issue #12211 has been updated by Shunichi Arai.
Shyouhei Urabe wrote:
> Naming-wise, Rails (ActiveSupport) has Date#beginning_of_month. That name can be more familiar to other devs.
>
> I'm against floor(:month) and such, especially against Time class. The concept of "the second that a day begins" is not that concrete when it relates to summer time. I recommend you to stick this proposal to Date only.
I think Date#beginning_of_month is bit verbose but okay too. How about to have an alias to Date#first_of_month?
floor(:month) looks elegant, but I think it's bit counter-intuitive. How about Date#day(n), Date#wday(n), or Date#year(n) which create a new date object with diffrent day / wday / year?
----------------------------------------
Feature #12211: introduce Date#first_of_month and Date#last_of_month
https://bugs.ruby-lang.org/issues/12211#change-57713
* Author: Shunichi Arai
* Status: Open
* Priority: Normal
* Assignee:
----------------------------------------
Proposes new methods Date#first_of_month and Date#last_of_month which can be very helpful in reporting applications which need the first and the last day of a month very frequently.
~~~
class Date
def first_of_month
Date.new(year, month, 1)
end
def last_of_month
next_month.first_of_month.prev_day
end
end
~~~
Current way to do it `Date.new(date.year, date.month, 1)` is not elegant and short enough for this simple and common operation.
--
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>