General

Profile

danielpclark (Daniel P. Clark)

  • Login: danielpclark
  • Email: 6ftdan@gmail.com
  • Registered on: 03/03/2015
  • Last sign in: 12/03/2018

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 2 11 13

Activity

12/03/2018

04:40 AM Ruby Bug #15370: Array#=== in long running loop continually consumes more RAM
Thanks both of you! :-) I saw some bad advice on StackOverflow and new that `case` worked as follows:
case 2
when *[1,2,3]
puts :winner
end
# => winner
So I had assumed it would work. My mistake.
danielpclark (Daniel P. Clark)
03:11 AM Ruby Bug #15370 (Rejected): Array#=== in long running loop continually consumes more RAM
I was doing a code challenge and trying to use as few characters as possible (not shown). So instead of using `Array#member?` I tried `Array#===` and it consumed my system's RAM once I switched to that.
The good code here:
fre...
danielpclark (Daniel P. Clark)

09/25/2017

09:19 PM Ruby Bug #13939: Ruby 2.4.2 has issue supporting Seattle.rb style for define_method
> Perhaps the error message could be more indicative of the error or what the exact
problem is or how to solve it. I understand that the () provide additional information
that is in some way useful to the parser, or whatever is respons...
danielpclark (Daniel P. Clark)
03:43 PM Ruby Bug #13939 (Rejected): Ruby 2.4.2 has issue supporting Seattle.rb style for define_method
In Ruby 2.3 & 2.4.0 you can do this
~~~ruby
define_method :some_method_name { "asdf" }
~~~
As of my trying 2.4.2 this is no longer supported. Anyone who tries to load my 'read_source' gem will get a failure message in require wi...
danielpclark (Daniel P. Clark)

05/27/2017

12:23 AM Ruby Feature #13601: Remove yield_self from Ruby 2.5 (already implemented)
You both have provided better examples as to the differences. Also finding out `yield_self` returns an Enumerator was a new one to me. I guess this feature request can be closed. danielpclark (Daniel P. Clark)

05/26/2017

07:35 PM Ruby Feature #13601 (Closed): Remove yield_self from Ruby 2.5 (already implemented)
Issue https://bugs.ruby-lang.org/issues/6721 for adding `yield_self` is unnecessary as `BasicObject#instance_eval` will do the exact same thing.
~~~ruby
class BasicObject
alias :yield_self :instance_eval
end
2.yield_self { |x|...
danielpclark (Daniel P. Clark)

04/19/2016

10:02 AM Ruby Feature #12281: Allow lexically scoped use of refinements with `using {}` block syntax
I found a way to use refinements in a block anywhere! Yay :-)
~~~ruby
module Moo
refine Fixnum do
def to_s
"moo"
end
end
end
class << Class.new # valid Ruby 2.3.0
using Moo
1.to_s
end
# => "moo"
...
danielpclark (Daniel P. Clark)

04/14/2016

03:56 AM Ruby Feature #12281: Allow lexically scoped use of refinements with `using {}` block syntax
I would also like the block for `using` to have access to local variables.
~~~ruby
def example(thing)
using MyCapitalize do
thing.my_capitalize
end
end
example "hello"
# => "Hello"
~~~
danielpclark (Daniel P. Clark)
03:48 AM Ruby Feature #12281 (Assigned): Allow lexically scoped use of refinements with `using {}` block syntax
In Ruby 2.2.3 a refinement could be used in a begin/end block.
~~~ruby
module Moo
refine Fixnum do
def to_s
"moo"
end
end
end
begin # valid Ruby 2.2.3 and NOT Ruby 2.3
using Moo
1.to_s
end
# => "moo...
danielpclark (Daniel P. Clark)
02:45 AM Ruby Bug #11704: Refinements only get "used" once in loop
Tsuyoshi Sawada wrote:
> I had made a feature request #12079 (later than this post) to allow refinements to be effective in such cases.
I like it. One note: Your code examples don't have a lexically scoped block. For them to work i...
danielpclark (Daniel P. Clark)

Also available in: Atom