<tsujp>
I'm using a gem which takes either an Enumerable or an Array as some source data and I want to only view a specific range of that data at a time. I could use #slice on the Array but that will return a new Array and I cannot re-initialise this object the gem provides
<tsujp>
I could use #slice! but then I'd lose the other elements. I effectively want a sliding window by reference, is there any existing way to do this in Ruby or shall I make a little custom thing?
cartdrige has quit [Ping timeout: 252 seconds]
<jhass[m]>
Sounds like a custom thingy
<jhass[m]>
but also sounds like you're likely to confuse the hell out of that poor little gem
<tsujp>
I will bribe it with sweet candy
<tsujp>
OH it has a method to return it's data source after you provide it so I can just do `the_object.sources = original_data.slice()` if that makes sense
<tsujp>
Just tested it then and it works.. noice
<tsujp>
It's kind of wasteful on memory though (not important here just me being pedantic)
<tsujp>
IO:Buffer has a #slice which it describes as a "view" i.e. it does _not_ copy memory
razetime has quit [Quit: See You Space Cowboy]
razetime has joined #ruby
jhawthorn_ has joined #ruby
jhawthorn has quit [Ping timeout: 252 seconds]
Furai has joined #ruby
razetime has quit [Ping timeout: 248 seconds]
Linux_Kerio has quit [Ping timeout: 252 seconds]
John_Ivan__ has quit [Read error: Connection reset by peer]
John_Ivan_ has joined #ruby
lucartc has joined #ruby
leonthemisfit has quit [Quit: WeeChat 3.6]
cartdrige has joined #ruby
Sankalp has quit [Ping timeout: 252 seconds]
Sankalp has joined #ruby
Sankalp has quit [Ping timeout: 265 seconds]
Sankalp- has joined #ruby
Sankalp- is now known as Sankalp
dviola has quit [Quit: WeeChat 3.8]
Sankalp has quit [Ping timeout: 252 seconds]
Sankalp has joined #ruby
walez has quit [Quit: Leaving]
Sankalp has quit [Ping timeout: 260 seconds]
Sankalp has joined #ruby
moldorcoder7 has joined #ruby
Sankalp- has joined #ruby
plantman2 has joined #ruby
Sankalp has quit [Ping timeout: 260 seconds]
Sankalp- is now known as Sankalp
plantman2 has quit [Ping timeout: 246 seconds]
razetime has joined #ruby
razetime has quit [Read error: Connection reset by peer]
razetime has joined #ruby
<tsujp>
Is there a way to pass an argument using the pretzel colon syntax? Given `foo = ['a', 'b', 'c']` I can do this `foo.send(:slice, 1)` which returns `'b'` but I cannot do `foo.select(&:slice, 0)`
hightower2 has quit [Ping timeout: 260 seconds]
mooff has quit [Remote host closed the connection]
mooff has joined #ruby
<wnd>
not what you asked, but perhaps you'd like to try select { _1.slice(0) } instead
caedmon has joined #ruby
crankharder has joined #ruby
otisolsen70 has quit [Quit: Leaving]
<tsujp>
What is _ there?
<tsujp>
The underscore
hightower2 has joined #ruby
<sam113101>
tsujp: _1 is first argument, _2 is second, etc.
<tsujp>
This is mostly a yak-shave, I (not an expert Rubyist) cannot see a way to keep the pretzel colon syntax, it's gotta be either a full block or obtuse underscore syntax
stirl has quit [Remote host closed the connection]
FullMetalStacker has joined #ruby
FullMetalStacker has quit [Client Quit]
crax23 has joined #ruby
cartdrige has quit [Ping timeout: 265 seconds]
splud has quit [Ping timeout: 272 seconds]
Linux_Kerio has joined #ruby
Laplace has joined #ruby
caedmon has quit [Quit: caedmon]
Vonter has quit [Ping timeout: 268 seconds]
<adam12>
Exception ArgumentError -> "ge><Requ" is not an octal string
<adam12>
... I wonder what that could be.
mooff has quit [Read error: Connection reset by peer]
mooff has joined #ruby
caedmon has joined #ruby
ultralan has quit [Remote host closed the connection]
<ox1eef_>
What's the context
<adam12>
ox1eef_: Fetching .gem from rubygems.org and then unpacking.
<ox1eef_>
Yikes o_O
<adam12>
It kidn of looks like <Range><Request> or something.
<adam12>
I need to add some debugging so I can figure it out. It's peculiar tho.
<ox1eef_>
Indeed. Maybe try tar directly, and/or verify what type of file it is with 'file'. I think rubygems.org also has checksums on the gem page, it might be corrupted.
caedmon has quit [Quit: caedmon]
_ht has quit [Quit: _ht]
ur5us has joined #ruby
aeris has quit [Remote host closed the connection]
aeris has joined #ruby
dviola has joined #ruby
Y05hito__ has joined #ruby
crax23 has quit [Ping timeout: 268 seconds]
Y05hito__ has quit [Ping timeout: 260 seconds]
ur5us has quit [Quit: Leaving]
cartdrige has joined #ruby
crax23 has joined #ruby
cartdrige has quit [Ping timeout: 252 seconds]
agent_white has quit [Ping timeout: 265 seconds]
Sankalp has quit [Ping timeout: 260 seconds]
desnudopenguino1 has joined #ruby
mooff has quit [Remote host closed the connection]
mooff has joined #ruby
desnudopenguino has quit [Ping timeout: 255 seconds]
desnudopenguino1 is now known as desnudopenguino
Laplace has quit [Quit: Connection closed for inactivity]
crankharder has quit [Ping timeout: 272 seconds]
tomtmym has quit [Quit: Gone.]
otisolsen70 has quit [Quit: Leaving]
reset has joined #ruby
ruby[bot] has quit [Remote host closed the connection]