General

Profile

najamelan (Naja Melan)

  • Login: najamelan
  • Registered on: 07/18/2016
  • Last sign in: 02/23/2017

Issues

open closed Total
Assigned issues 0 0 0
Reported issues 0 1 1

Activity

02/12/2017

04:22 PM Ruby Feature #2740: Extend const_missing to pass in the nesting
This would still be very useful for people implementing auto loading systems, not just Rails najamelan (Naja Melan)

07/19/2016

07:25 PM Ruby Feature #7361: Adding Pathname#touch
I prefer something like (warning, untested code):
~~~ ruby
def touch( subPath = '', **options )
path = @path
ret = self
if directory?
ret = join subPath
path = ret.to_path
end
FileUtils.touch( path, **opti...
najamelan (Naja Melan)
09:05 AM Ruby Feature #12593: Allow compound assignements to work when destructuring arrays
What I propose is to translate the construct:
~~~ ruby
a = 3
b = [ 2 ]
a, b = 2, 3, 4
a == 2
b == 3
# 4 is ignored
a, b = 2
a == 2
b == nil
~~~
That's current behaviour if the number of elements is not the sam...
najamelan (Naja Melan)

07/18/2016

05:58 PM Ruby Bug #10837: spatting a single element array produces an array instead of a single value for return and next
@bug hit
My apologies, it seems I'm mistaken. The splat operator does not just seem to coerce into array for all types:
~~~ ruby
a = { a: 1 }
p [a] # [{:a=>1}]
p *a # [:a, 1]
p [*a] # [[:a, 1]]
~~~
It seems it calls...
najamelan (Naja Melan)
12:47 PM Ruby Bug #10837: spatting a single element array produces an array instead of a single value for return and next
bug hit wrote:
> Nobuyoshi Nakada wrote:
> ...
Actually this is really useful. Whenever a method accepts a `something` or an `array of somethings` you can use the splat operator to make it an array if it's not already. Now you can oper...
najamelan (Naja Melan)
12:59 PM Ruby Feature #12593 (Rejected): Allow compound assignements to work when destructuring arrays
~~~ ruby
a = [ 'a', 'b' ]
b = [ 'c', 'd' ]
def c
return [ 'A', 'B' ], [ 'C', 'D' ]
end
a, b += c # -> would be awesome, but gives syntax error
a, b = a + c.first, b + c.last # clunky and will call method twice...
...
najamelan (Naja Melan)

Also available in: Atom