i1nfusion has quit [Remote host closed the connection]
i1nfusion has joined #ruby
cschneid has joined #ruby
claudiuinberlin has joined #ruby
kyrylo has joined #ruby
sidx64 has joined #ruby
cschneid has quit [Ping timeout: 245 seconds]
D9 has quit [Read error: Connection reset by peer]
D9 has joined #ruby
esrse has joined #ruby
moei has joined #ruby
interruptinuse has left #ruby [#ruby]
postmodern has quit [Quit: Leaving]
i1nfusion has quit [Remote host closed the connection]
jottr has quit [Ping timeout: 244 seconds]
cschneid has joined #ruby
i1nfusion has joined #ruby
alem0lars has quit [Remote host closed the connection]
alem0lars has joined #ruby
i1nfusion has quit [Remote host closed the connection]
i1nfusion has joined #ruby
nowhereman has joined #ruby
doodlebug has quit [Ping timeout: 245 seconds]
i1nfusion has quit [Remote host closed the connection]
i1nfusion has joined #ruby
nowhere_man has quit [Ping timeout: 245 seconds]
t0xik has quit [Quit: Connection closed for inactivity]
conta has quit [Ping timeout: 246 seconds]
LtHummus has quit [Ping timeout: 255 seconds]
yield has quit [Remote host closed the connection]
yield has joined #ruby
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
LtHummus has joined #ruby
za1b1tsu_ has quit [Remote host closed the connection]
jottr has joined #ruby
yield has quit [Remote host closed the connection]
yield has joined #ruby
doodlebug has joined #ruby
ur5us has quit [Remote host closed the connection]
ur5us has joined #ruby
esrse has quit [Ping timeout: 268 seconds]
sidx64 has joined #ruby
ur5us has quit [Ping timeout: 246 seconds]
jenrzzz has joined #ruby
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mangold has joined #ruby
sidx64 has joined #ruby
lxsameer has joined #ruby
jenrzzz has quit [Ping timeout: 255 seconds]
cschneid has quit [Ping timeout: 244 seconds]
TvL2386_ has quit [Quit: leaving]
TvL2386 has joined #ruby
queip has quit [Quit: bye, freenode]
nowhereman has quit [Ping timeout: 246 seconds]
moei has quit [Read error: Connection reset by peer]
moei has joined #ruby
i1nfusion has quit [Remote host closed the connection]
queip has joined #ruby
Swyper has joined #ruby
Swyper has quit [Ping timeout: 246 seconds]
KeyJoo has joined #ruby
conta has joined #ruby
Swyper has joined #ruby
Fusl has quit [Remote host closed the connection]
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Fusl has joined #ruby
Swyper has quit [Ping timeout: 255 seconds]
jenrzzz has joined #ruby
_ikke_ has quit [Quit: WeeChat 2.3]
_ikke_ has joined #ruby
HendrikPeter has joined #ruby
jenrzzz has quit [Ping timeout: 250 seconds]
cschneid has joined #ruby
sidx64 has joined #ruby
doodleb10 has joined #ruby
keden has quit [Quit: WeeChat 2.4]
doodlebug has quit [Ping timeout: 245 seconds]
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mat_bug has joined #ruby
Swyper has joined #ruby
d^sh has quit [Ping timeout: 268 seconds]
sidx64 has joined #ruby
d^sh has joined #ruby
Swyper has quit [Ping timeout: 245 seconds]
doodleb10 has quit [Read error: Connection reset by peer]
sidx64 has quit [Client Quit]
sidx64 has joined #ruby
doodlebug has joined #ruby
hanmac1 has joined #ruby
apparition has joined #ruby
bokwoon has joined #ruby
yield has quit [Remote host closed the connection]
hanmac has quit [Ping timeout: 268 seconds]
cschneid has quit [Ping timeout: 250 seconds]
kujira has quit [Ping timeout: 245 seconds]
AJA4350 has joined #ruby
ldnunes has joined #ruby
mhlei has quit [Remote host closed the connection]
mhlei has joined #ruby
blaguvest has joined #ruby
Some-body_ has joined #ruby
nowhereman has joined #ruby
DarthGandalf has quit [Ping timeout: 252 seconds]
Some-body_ is now known as DarthGandalf
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
RedSnarf has joined #ruby
vondruch has quit [Ping timeout: 268 seconds]
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
kapil____ has quit [Quit: Connection closed for inactivity]
daniel____ has quit [Read error: Connection reset by peer]
daniel____ has joined #ruby
vondruch has joined #ruby
sidx64 has joined #ruby
jottr has quit [Ping timeout: 268 seconds]
cschneid has joined #ruby
ogurk_ has joined #ruby
jottr has joined #ruby
<ogurk_>
is rubygems using OS certs for accessing rubygems? I'm proxy rubygems via artifatory that's fronted with internal certs. While trying to install gem I'm getting ssl verify error.
<ogurk_>
internal ca is added locally - but apparently not used
mangold has quit [Quit: This computer has gone to sleep]
jenrzzz has quit [Ping timeout: 245 seconds]
mat_bug has quit []
galaxie has quit [Remote host closed the connection]
ellcs has quit [Ping timeout: 252 seconds]
galaxie has joined #ruby
RedSnarf has quit [Quit: Yaaic - Yet another Android IRC client - http://www.yaaic.org]
polishdub has joined #ruby
krawchyk has quit [Ping timeout: 245 seconds]
conta has joined #ruby
za1b1tsu has quit [Remote host closed the connection]
daniel__ has joined #ruby
Swyper has joined #ruby
daniel____ has quit [Ping timeout: 246 seconds]
rippa has joined #ruby
nowhereman has quit [Ping timeout: 245 seconds]
Swyper has quit [Remote host closed the connection]
s3nd1v0g1us has quit [Read error: Connection reset by peer]
daniel__ has quit [Quit: Leaving]
daniel____ has joined #ruby
Swyper has joined #ruby
zachk has joined #ruby
sylario has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Dbugger has joined #ruby
DmitryBochkarev has quit [Remote host closed the connection]
mondz has quit [Ping timeout: 250 seconds]
DmitryBochkarev has joined #ruby
alem0lars has quit [Ping timeout: 246 seconds]
Inline has joined #ruby
jottr_ has joined #ruby
UnknownSoldier has joined #ruby
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jottr has quit [Ping timeout: 246 seconds]
donofrio has quit [Remote host closed the connection]
andikr has quit [Remote host closed the connection]
vulcan has joined #ruby
Swyper has quit [Remote host closed the connection]
donofrio has joined #ruby
conta2 has joined #ruby
mondz has joined #ruby
mondz has quit [Remote host closed the connection]
mondz has joined #ruby
my-nick has joined #ruby
my-nick has quit [Client Quit]
conta2 has quit [Quit: conta2]
eddof13 has joined #ruby
eddof13 has quit [Client Quit]
Swyper has joined #ruby
ferr has quit [Quit: WeeChat 2.4]
eddof13 has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
neovalis0 has joined #ruby
clemens3 has quit [Ping timeout: 255 seconds]
lxsameer has quit [Ping timeout: 246 seconds]
nowhereman has joined #ruby
yield has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
jottr has joined #ruby
mondz has quit [Quit: ERC (IRC client for Emacs 26.1)]
jenrzzz has joined #ruby
mondz has joined #ruby
prestorium has quit [Ping timeout: 246 seconds]
brool has joined #ruby
jottr_ has quit [Ping timeout: 255 seconds]
wallace_mu has joined #ruby
yield has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 240 seconds]
orbyt_ has joined #ruby
mondz has quit [Remote host closed the connection]
my-nick has joined #ruby
my-nick has quit [Client Quit]
hxegon has joined #ruby
waheedi has quit [Quit: waheedi]
orbyt_ has quit [Client Quit]
neovalis0 has quit [Ping timeout: 245 seconds]
mondz has joined #ruby
jcarl43 has joined #ruby
orbyt_ has joined #ruby
polishdub has quit [Quit: leaving]
orbyt_ has quit [Ping timeout: 246 seconds]
hxegon has quit [Remote host closed the connection]
hxegon has joined #ruby
orbyt_ has joined #ruby
polishdub has joined #ruby
neovalis0 has joined #ruby
dviola has joined #ruby
neovalis0 has quit [Ping timeout: 245 seconds]
gix has joined #ruby
aqd has joined #ruby
vulcan has quit [Quit: Leaving]
neovalis0 has joined #ruby
dellavg_ has joined #ruby
yield has joined #ruby
hightower3 has joined #ruby
jenrzzz has joined #ruby
waheedi has joined #ruby
duderonomy has joined #ruby
yield has quit [Ping timeout: 255 seconds]
jenrzzz has quit [Ping timeout: 268 seconds]
clemens3 has joined #ruby
conta has quit [Remote host closed the connection]
mwlang has joined #ruby
<mwlang>
Typically when I want to not have to do a check if a variable contains an array of values before starting a loop, I’ll do something like Array(foo).each { … } Works fairly well except for when foo is a Hash.
<mwlang>
Array({foo: :bar, fiz: :batz}) => l[[:foo, :bar], [:fiz, :batz]] instead of what I was expecting, which would be: [{foo: :bar}]
hiroaki has joined #ruby
<mwlang>
although I can work around this with conditional, I’m curious as to why Hashes are treated differently by the Array() “cast” method than other types are.
brool has quit [Quit: WeeChat 2.4]
brool has joined #ruby
<mwlang>
looks like I can get away with not converting Hash variable into arrays themselves by using [foo].flatten.each { … }
gregf_ has quit [Ping timeout: 256 seconds]
<phaul>
you haven't told us why you would do this, it really feels xy problem to me
<ytti>
i use [var].flatten pattern a lot, when i want method to accept value or list of values
<ytti>
but i'm not sure how this applies to hash, because are you then setting they key or value?
neovalis0 has quit [Ping timeout: 246 seconds]
<ytti>
you have just one variable, how do you create dummy hash out of it?
<ytti>
like you can do {}.merge(hash).each
dellavg_ has quit [Ping timeout: 246 seconds]
<ytti>
but i don't understand where it would make sense
<phaul>
[*var] is a bit more succint maybe
yield has joined #ruby
alem0lars has joined #ruby
bokwoon has quit [Quit: WeeChat 2.5-dev]
<mwlang>
well, I am parsing an XML document. if an element appears multiple times, it’s returned as an array…it it appears only once, it’s returned as just that element (not in an array)
<mwlang>
so to be “safe” in following nested sections, I want to cast to Array so I always “have an array” and then loop to go deeper in the nest.
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Xiti` has quit [Quit: Xiti`]
yield has quit [Ping timeout: 245 seconds]
<phaul>
and if you get a hash that's just one element?
<mwlang>
correct.
Xiti has joined #ruby
<phaul>
[elem].flatten as ytti said or [*elem] as I said, whichever you like more
<mwlang>
so [foo] on an array gives me [[foo]] while [foo] on hash gives me [foo]. Thus the flatten call to keep things unchange.
cloaked1 has joined #ruby
<mwlang>
right. I already came to that conclusion. I’m just wondering about the reasoning behind ruby treating hashes differently with the Array cast.
<mwlang>
seems to violate principle of least surprise, at least for me.
<phaul>
the OO aproach would be to return [] or at least the same type from xml parsing
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<mwlang>
I agree with you on that. but I didn’t write the XML => hash parser, so I’m regularizing it after the fact.
<havenwood>
mwlang: Ruby is the principle of least surprise for Matz, just Matz.
<mwlang>
LOL — then he and I think too much alike…:-p
<havenwood>
mwlang: The idea is that it's more useful generally to have Hashes destructure into pairs with #to_a, so you can move between Hash and Array.
<mwlang>
except looping over key/value pairs of a flat hash, but that’s pretty much part of the Ruby syntax magic there.
<havenwood>
mwlang: Kernel::Array uses #to_ary over #to_a if it's defined, so you can change its behavior by implementing #to_ary.
orbyt_ has joined #ruby
<havenwood>
mwlang: But yeah, Hashes have a bit of an odd #to_a, so they can go to Arrays and back since Enumerable only uses Array as the reducing object.
<mwlang>
Nice way to do that.
<mwlang>
I only have one place in the code (so far) where I’m dealing with coercing a Hash variable into an array of Hash variables for all depths of processing elements in the XML, so getting fancy isn’t really called for here. But definitely a great tip to keep in mind for future.
duderonomy has joined #ruby
yield has joined #ruby
sidx64_ has joined #ruby
sidx64 has quit [Ping timeout: 250 seconds]
kujira has joined #ruby
postmodern has joined #ruby
<mwlang>
speaking of looping hashes, has it always been possible to do this? {foo: 1, bar:2}.map {|k,v| puts [k,v].join(' => ')} => “foo => 1\nbar => 2”
<mwlang>
I mean, using #map and #each and having both key and value in the loop
conta has joined #ruby
<mwlang>
I used to use #each_pair for that, but at some point, I forgot the “_pair” when writing a loop and it worked.
cd has joined #ruby
<mwlang>
made me wonder if I learnt wrongly in the beginning or if this capability came along after Ruby 1.8.6
doodlebug has quit [Read error: Connection reset by peer]
Fusl has quit [Quit: K-Lined]
HendrikPeter has joined #ruby
<phaul>
but that's 1.8.7 and you are asking 1.8.6 , so donno
Fusl has joined #ruby
doodlebug has joined #ruby
samort7 has quit [Quit: Page closed]
<mwlang>
I did a little digging. I think it has always had ability to return two variables with Hash#each and Hash#each_pair made it clear two variables were passed, so I learned #each_pair for iterating hash keys way early on.
<mwlang>
I’m sure back then I didn’t know that if I provided two variables, Ruby would intelligently assign individual variables.
<syndikate>
In this example, the array inside gets created and destroyed each time the method is called, right? Is the reason being going out of scope?
<syndikate>
Ah okay, it would be the same in any language right?
<havenwood>
syndikate: To prevent multiple Arrays, set that as a Constant - and for extra credit, freeze it.
<mwlang>
depends on the language for sure.
<havenwood>
syndikate: FRUIT = %w[apple mango].freeze
<havenwood>
syndikate: Then in the method, just: FRUIT.include?(fruit)
<havenwood>
syndikate: And add a frozen string literal for the String freezing
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jtdowney has quit [Read error: Connection reset by peer]
<syndikate>
Thanks, yeah, that's what I do havenwood, but that habit came to me from somewhere and was there without me thinking. So, I was just thinking about this now. I was curious for any language that would destroy objects after scope, this would be the same, right?
duderonomy has joined #ruby
<phaul>
a language potentially could discover that that's constant data and optimize it out
<mwlang>
@syndikate some languages that byte-compile may optimize away the array destruction on out of scope.
<havenwood>
syndikate: Even a Ruby implementation like TruffleRuby might be able to optimize that away as well
jtdowney has joined #ruby
<syndikate>
havenwood, Any string that is being used in a class I usually make it constant and freeze, and some arrays too.
<syndikate>
Oh, okay. What languages are there such?
<mwlang>
oh, gosh…I haven’t even thought about the variants other than MRI ruby as an option in years.
<mwlang>
@syndikate python, crystal, java
sauvin has quit [Ping timeout: 246 seconds]
jtdowney has quit [Client Quit]
<mwlang>
personally, I’d do what havenwood suggests just because having “magic” numbers and constants other than 0, 1, nil inside the methods is poor practice.
<syndikate>
Oh python does that ? :O
jtdowney has joined #ruby
<Bish>
adam12: okay, thanks :o
<havenwood>
syndikate: maybe PyPy?
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<mwlang>
you’ll have to go ask the python experts, but I do know python pre-compiles pretty aggressively so it has strong potential to optimize static variables inside methods.
<syndikate>
I didn't know it has such optimisations while ruby doesn't
<mwlang>
two very different beasts
duderonomy has joined #ruby
jtdowney has quit [Quit: jtdowney]
jtdowney has joined #ruby
yield has joined #ruby
ruby-lang136 has joined #ruby
TomyWork has quit [Ping timeout: 246 seconds]
duderonomy has quit [Client Quit]
conta has quit [Quit: conta]
ruby-lang136 has quit [Client Quit]
yield has quit [Ping timeout: 245 seconds]
Fira has joined #ruby
ellcs has joined #ruby
doodlebug has quit [Ping timeout: 255 seconds]
<syndikate>
Ah well something new for today
doodleb4 has joined #ruby
hhzza has quit [Quit: Connection closed for inactivity]
duderonomy has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<IGnorAND>
def initialize(list_type: "ALL", search_term: , page: 1, page_size: 20, sort_by:) <- does this force one to specify a search_term? Or is it optional?
code_zombie has joined #ruby
<mwlang>
@IGnorAND must specify…same for sort_by.
<mwlang>
the rest of the parameters are optional since you provided defaults.
Ai9zO5AP has quit [Quit: WeeChat 2.4]
<mwlang>
if you want everything optional…then use nil… (list_type: "ALL", search_term: nil, page: 1, page_size: 20, sort_by: nil)
r3m has quit [Quit: WeeChat 2.5-dev]
r3m has joined #ruby
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
yield has joined #ruby
Swyper has quit [Remote host closed the connection]
ellcs has quit [Ping timeout: 240 seconds]
Rapture has joined #ruby
duderonomy has joined #ruby
yield has quit [Ping timeout: 268 seconds]
alem0lars has quit [Ping timeout: 246 seconds]
Swyper has joined #ruby
segy has joined #ruby
Swyper has quit [Ping timeout: 268 seconds]
orbyt_ has quit [Ping timeout: 245 seconds]
sidx64_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DmitryBochkarev has quit [Ping timeout: 250 seconds]
neovalis0 has joined #ruby
Pablo[m] has joined #ruby
eddof13 has quit [Quit: eddof13]
mondz has quit [Read error: Connection reset by peer]
Iarfen has joined #ruby
<Iarfen>
hi!
Pablo[m] has left #ruby ["User left"]
<Iarfen>
how I can use byebug? I'm trying to use it with rails but I don't understand where the console appears
lxsameer has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yield has joined #ruby
<miah>
Iarfen: somewhere in your code, near the area you want to debug you need to add 'byebug' when ruby hits that method the console appears. its going to be in the same terminal as you started your application from.