adam12 changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.0.2, 2.7.4, 2.6.8: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
drincruz_ has quit [Ping timeout: 250 seconds]
mrkz_c has joined #ruby
yCrazyEdd has quit [Ping timeout: 250 seconds]
ur5us has quit [Ping timeout: 252 seconds]
lunarkitty has quit [Quit: Connection closed for inactivity]
<nakilon> heh, I have a String and I attach a "debug data" to it, like this: .tap{ |r| r.instance_variable_set :@last_response, response }
<nakilon> now the issue is that after I call #strip on it this instance variable seems to be gone
<nakilon> while I need it afterwards
perrierjouet has quit [Quit: WeeChat 3.2]
<nakilon> the instance variable attachment is in one place (my old gem), the .strip call is in the current program that uses it
ur5us has joined #ruby
<nakilon> what are my best options to preserve the last_response in such cases?
<nakilon> in the case of calling the standard class method that seems to be "destructive"
<nakilon> as I understand this https://github.com/ruby/ruby/blob/971d24cd97ecf0fea542071af5ef3b134eeb4a6b/string.c#L2612 only preserves the encoding in the lsat line
<nakilon> *last
drincruz_ has joined #ruby
drincruz_ has quit [Ping timeout: 276 seconds]
drincruz_ has joined #ruby
jetchisel has joined #ruby
drincruz_ has quit [Ping timeout: 255 seconds]
riceandbeans has quit [Ping timeout: 255 seconds]
riceandbeans has joined #ruby
Melantha has quit [Quit: WeeChat 3.2]
Melantha has joined #ruby
ur5us has quit [Ping timeout: 252 seconds]
neshpion has quit [Quit: neshpion]
Nik- has joined #ruby
gr33n7007h has quit [Ping timeout: 268 seconds]
reset has quit [Quit: reset]
teclator has joined #ruby
r0bby has quit [Ping timeout: 272 seconds]
r0bby has joined #ruby
easbarbosa has quit [Remote host closed the connection]
ecso has quit [Ping timeout: 252 seconds]
lad has quit [Remote host closed the connection]
lad has joined #ruby
ecso has joined #ruby
sri19 has joined #ruby
lunarkitty has joined #ruby
raw-bean has joined #ruby
raw-bean has quit [Ping timeout: 276 seconds]
raw-bean has joined #ruby
raw-bean has quit [Ping timeout: 268 seconds]
sri19 has quit [Remote host closed the connection]
fossdd has quit [Ping timeout: 252 seconds]
fossdd has joined #ruby
raw-bean has joined #ruby
Bounga has joined #ruby
raw-bean has quit [Ping timeout: 268 seconds]
raw-bean has joined #ruby
<rapha> hi all
<rapha> i there an elegant way to use Array#map to only modify the first element and return all others verbatim? or is a.each_with_index.map{|x,i| i==0 ? func(x) : x} the only way?
fossdd has quit [Ping timeout: 250 seconds]
fossdd has joined #ruby
<leftylink> it seems difficult for map to know it's only the first element. of course, the block could use a variable (one external to the block) to determine whether it has been run before?
jsaito has joined #ruby
<nakilon> I won't use map
lad has quit [Ping timeout: 258 seconds]
fossdd has quit [Ping timeout: 252 seconds]
fossdd has joined #ruby
TomyWork has joined #ruby
lunarkitty has quit [Quit: Connection closed for inactivity]
fossdd has quit [Ping timeout: 265 seconds]
fossdd has joined #ruby
raw-bean has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jsaito has quit [Quit: Leaving]
raw-bean has joined #ruby
mrkz_c has quit [Quit: Connection closed for inactivity]
<jhass[m]> yeah, what's wrong with a[0] = func(a[0])
pwnd_sfw9 has quit [Read error: Connection reset by peer]
pwnd_sfw has joined #ruby
drincruz_ has joined #ruby
<rapha> huh! thx jhass[m], it did feel like i was missing something :-P
<rapha> like, something simple, something obvious.
<jhass[m]> :P you're welcome
motherr has joined #ruby
fossdd has quit [Ping timeout: 250 seconds]
fossdd has joined #ruby
<rapha> i pin it to my adhd
<rapha> pin it to? on? on probably...
raw-bean has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
fossdd has quit [Ping timeout: 268 seconds]
fossdd has joined #ruby
raw-bean has joined #ruby
easbarbosa has joined #ruby
reset has joined #ruby
easbarbosa has quit [Read error: Connection reset by peer]
justsomeguy has joined #ruby
raw-bean has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
raw-bean has joined #ruby
Bounga has quit [Ping timeout: 240 seconds]
_whitelogger has joined #ruby
teclator has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
smarton has joined #ruby
chonkbit has joined #ruby
dviola has quit [Ping timeout: 265 seconds]
dviola has joined #ruby
dviola has joined #ruby
dviola has quit [Changing host]
fossdd has quit [Ping timeout: 265 seconds]
fossdd has joined #ruby
easbarbosa has joined #ruby
easbarbosa has quit [Remote host closed the connection]
easbarbosa has joined #ruby
motherr has quit [Quit: zzz]
lad has joined #ruby
cahoots has joined #ruby
<cahoots> hi, when doing a multiline regex, is there a way to indicate the end of the whole string?
jetchisel has quit [Ping timeout: 240 seconds]
goldfish has joined #ruby
jetchisel has joined #ruby
orbyt has joined #ruby
jetchisel has quit [Max SendQ exceeded]
<adam12> cahoots: \z?
swaggboi has quit [Quit: C-x C-c]
fossdd has quit [Ping timeout: 252 seconds]
fossdd has joined #ruby
<cahoots> adam12, ty
drincruz has joined #ruby
drincruz_ has quit [Read error: Connection reset by peer]
crankharder has joined #ruby
drincruz has quit [Ping timeout: 272 seconds]
drincruz has joined #ruby
goldfish has quit [Ping timeout: 256 seconds]
swaggboi has joined #ruby
swaggboi has quit [Client Quit]
goldfish has joined #ruby
swaggboi has joined #ruby
drincruz has quit [Ping timeout: 265 seconds]
drincruz has joined #ruby
qunzhong_luxian has joined #ruby
QuasarDeneb has joined #ruby
QuasarDeneb has quit [Changing host]
QuasarDeneb has joined #ruby
QuasarDeneb has quit [Client Quit]
QuasarDeneb has joined #ruby
motherr has joined #ruby
drincruz has quit [Read error: Connection reset by peer]
drincruz_ has joined #ruby
goldfish has quit [Ping timeout: 256 seconds]
qunzhong_luxian has quit [Changing host]
qunzhong_luxian has joined #ruby
postmodern has joined #ruby
<postmodern> weird question, but does Process.uid available or works similarly on windows?
TomyWork has quit [Quit: Leaving]
qunzhong_luxian has quit [Quit: leaving]
qunzhong_luxian has joined #ruby
QuasarDeneb has quit [Quit: Textual IRC Client: www.textualapp.com]
pgib has joined #ruby
Nik- has quit [Quit: My Mac Mini has gone to sleep. ZZZzzz…]
justsomeguy has quit [Quit: WeeChat 3.2]
qunzhong1luxian has joined #ruby
qunzhong_luxian has quit [Ping timeout: 240 seconds]
fossdd has quit [Ping timeout: 250 seconds]
fossdd has joined #ruby
fossdd has quit [Ping timeout: 250 seconds]
fossdd has joined #ruby
fossdd has quit [Ping timeout: 250 seconds]
fossdd has joined #ruby
qunzhong1luxian has quit [Quit: leaving]
qunzhong_luxian has joined #ruby
cahoots has quit [Ping timeout: 256 seconds]
cahoots has joined #ruby
qunzhong_luxian has quit [Quit: leaving]
qunzhong_luxian has joined #ruby
mrkz_c has joined #ruby
gcd has quit [Ping timeout: 268 seconds]
<nakilon> are things like these now easier with "pattern matching" in Ruby? https://dpaste.org/3bTJ/slim
<nakilon> or maybe there is some specific cool gem to assert the json structure
slothby has quit [Ping timeout: 268 seconds]
gcd has joined #ruby
slothby has joined #ruby
<nakilon> I don't want to write a ton of "fail unless" -- I want to write all the regexes and rules in one object
<adam12> nakilon: dry-schema or dry-validation?
<nakilon> dry is a sect
<adam12> O_O
<nakilon> and doesn't see like any clearer than multiple fail unlesses https://dry-rb.org/gems/dry-schema/1.5/
<nakilon> *seem to be any
<weaksauce> i mean it does error reporting in the object
<nakilon> yeah I don't see neat error messages in json-schema
<nakilon> I already did similar schema check in my old project that was checking if data are collected correctly before putting it as noSQL values -- it was telling where and what went wrong, but I don't want to make the wheel again
<nakilon> or do I...
<weaksauce> that dry library looks pretty solid tbh
<nakilon> and not DRY at all
<nakilon> they are just piling together dozens of non-related gems under the dry-* namespace because they are the company of friends
<nakilon> that's how I see it
fossdd has quit [Ping timeout: 276 seconds]
fossdd has joined #ruby
<oz> these are more utils/oop support libs, than "DRY" as in "Dont' Repeat Yourself"
<oz> but it's a pretty cool project. :)
<weaksauce> yeah does it need to be dry for you to use it?
<weaksauce> though it is somewhat dry in the sense that your validations are all in one place
<nakilon> does is it to add "dry-" prefix in every gem name? it's like ads banners
<nakilon> this works: https://dpaste.org/pPYy/slim
<nakilon> so it took only 20 minutes to implement most of it, now only needs Array checks and maybe something else
<nakilon> more complex assertions will be harder to make, like "this one hash keys should be equal to this one .map{ ... }", but probably possible
<weaksauce> seems kinda brittle for what you gain
<weaksauce> but you do you
<nakilon> either put callback in some common ancestor or using some kinds of anchors
qunzhong_luxian has quit [Quit: leaving]
ur5us has joined #ruby
fossdd has quit [Ping timeout: 245 seconds]
fossdd has joined #ruby
gcd has quit [Ping timeout: 255 seconds]
fossdd has quit [Ping timeout: 276 seconds]
fossdd has joined #ruby
motherr has quit [Quit: zzz]
fossdd has quit [Ping timeout: 256 seconds]
fossdd has joined #ruby
drincruz has joined #ruby
drincruz_ has quit [Ping timeout: 258 seconds]
fossdd has quit [Ping timeout: 265 seconds]
fossdd has joined #ruby
<rg> maybe dry isn't for you but it provides much needed diversity in an ecosystem dominated by rails, i dont hate rails or anything but competition is healthy.
fossdd has quit [Ping timeout: 276 seconds]
<nakilon> I'm not into websites
fossdd has joined #ruby
crankharder has quit [Ping timeout: 258 seconds]
orbyt has quit [Quit: Textual IRC Client: www.textualapp.com]
ua_ has quit [Ping timeout: 250 seconds]
shokohsc has quit [Read error: Connection reset by peer]
shokohsc has joined #ruby
ua_ has joined #ruby
finsternis has quit [Remote host closed the connection]
fossdd has quit [Ping timeout: 252 seconds]
fossdd has joined #ruby
drincruz_ has joined #ruby
crankharder has joined #ruby
drincruz has quit [Ping timeout: 268 seconds]
fossdd has quit [Ping timeout: 240 seconds]
fossdd has joined #ruby
jetchisel has joined #ruby
crankharder has quit [Ping timeout: 258 seconds]
crankharder has joined #ruby
finsternis has joined #ruby