havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 2.7.2, 2.6.6, 3.0.0-preview1: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.org | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | BLM <3 | Can't talk? Register/identify with NickServ
roshanavand has quit [Ping timeout: 256 seconds]
roshanavand_ is now known as roshanavand
ignorand has quit [Remote host closed the connection]
crankharder has joined #ruby
BenDover has quit [Quit: BenDover]
crankharder has quit [Ping timeout: 272 seconds]
ur5us_ has quit [Ping timeout: 260 seconds]
crankharder has joined #ruby
pwnd_sfw has quit [Ping timeout: 260 seconds]
DaRock has joined #ruby
roshanavand_ has joined #ruby
roshanavand has quit [Ping timeout: 272 seconds]
roshanavand_ is now known as roshanavand
s2013 has joined #ruby
crankharder has quit [Ping timeout: 240 seconds]
<riceandbeans> rubocop says I should say .positive? instead of it should > 0, but that raises errors, what would be the correct syntax
SeepingN has quit [Quit: The system is going down for reboot NOW!]
<riceandbeans> its(:foo) { should be positive }
<adam12> riceandbeans: rspec?
<riceandbeans> yeah
bsdbandit-01 has joined #ruby
pwnd_sfw has joined #ruby
bmurt has joined #ruby
bmurt has quit [Client Quit]
bmurt has joined #ruby
gix has quit [Ping timeout: 240 seconds]
nakilon has quit [Quit: Ping timeout (120 seconds)]
nakilon has joined #ruby
bsdbandit-01 has quit [Read error: Connection reset by peer]
jenrzzz has quit [Ping timeout: 256 seconds]
adu has joined #ruby
cloud69 has joined #ruby
adu has quit [Client Quit]
adu has joined #ruby
bromps_ has joined #ruby
adu has quit [Quit: adu]
fluxAeon has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
crankharder has joined #ruby
crankharder has quit [Ping timeout: 260 seconds]
Pitbull has quit [Quit: Diabe? tkwi w szczegó?ach]
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
Guest53 has joined #ruby
Guest53 is now known as provkme
provkme is now known as provkmee
bromps_ has quit [Read error: Connection reset by peer]
ChmEarl has quit [Quit: Leaving]
provkmee has quit [Quit: Textual IRC Client: www.textualapp.com]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
akem has quit [Ping timeout: 260 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has joined #ruby
dfucci has joined #ruby
bambanx has quit [Quit: Leaving]
dfucci has quit [Ping timeout: 264 seconds]
howdoi has quit [Quit: Connection closed for inactivity]
s2013 has joined #ruby
Omnilord has quit [Quit: This computer has gone to sleep]
Omnilord has joined #ruby
crankharder has joined #ruby
cloud69 has quit [Quit: Connection closed for inactivity]
crankharder has quit [Ping timeout: 272 seconds]
Rudd0 has quit [Ping timeout: 272 seconds]
chouhoul_ has joined #ruby
chouhoulis has quit [Ping timeout: 246 seconds]
fluxAeon has quit [Ping timeout: 240 seconds]
_whitelogger has joined #ruby
bocaneri has joined #ruby
bocaneri has quit [Max SendQ exceeded]
bocaneri has joined #ruby
bocaneri has quit [Max SendQ exceeded]
bocaneri has joined #ruby
chouhoulis has joined #ruby
chouhoul_ has quit [Read error: Connection reset by peer]
bocaneri has quit [Max SendQ exceeded]
bocaneri has joined #ruby
bocaneri has quit [Max SendQ exceeded]
bocaneri has joined #ruby
bocaneri has quit [Max SendQ exceeded]
bocaneri has joined #ruby
bocaneri has quit [Remote host closed the connection]
akem has joined #ruby
akem has quit [Remote host closed the connection]
akem has joined #ruby
Omnilord has quit [Quit: Leaving]
crankharder has joined #ruby
cloud69 has joined #ruby
crankharder has quit [Ping timeout: 265 seconds]
dfucci has joined #ruby
powerhouse has quit [Quit: Leaving]
weaksauce has quit [Ping timeout: 260 seconds]
dfucci has quit [Ping timeout: 256 seconds]
vondruch has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
Glumetu has joined #ruby
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
dfucci has joined #ruby
powerhouse has joined #ruby
cthulchu_ has quit [Ping timeout: 264 seconds]
<Tuor> nakilon: .flush worked, thx.
jenrzzz has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
bocaneri has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
cd has quit [Quit: cd]
bocaneri has quit [Max SendQ exceeded]
bocaneri has joined #ruby
supercoven has joined #ruby
hadi has joined #ruby
hadi has quit [Remote host closed the connection]
<nakilon> Tuor, nice; (I meant "rewind" not "write" though, but you figured it out I guess)
<Tuor> nakilon: yes. ;)
jenrzzz has quit [Ping timeout: 260 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hiroaki has quit [Ping timeout: 256 seconds]
crankharder has joined #ruby
crankharder has quit [Ping timeout: 240 seconds]
booboy has quit [Quit: ZNC - https://znc.in]
booboy has joined #ruby
Rudd0 has joined #ruby
lapsa_ has joined #ruby
lapsa_ has quit [Ping timeout: 256 seconds]
gavlee has quit [Ping timeout: 260 seconds]
gavlee has joined #ruby
lapsa_ has joined #ruby
TomyWork has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
crankharder has joined #ruby
Pitbull has joined #ruby
mtsd has joined #ruby
Pitbull is now known as TCZ
crankharder has quit [Ping timeout: 260 seconds]
gavlee has quit [Ping timeout: 246 seconds]
ignorand has joined #ruby
<TCZ> iam low effort troll
gavlee has joined #ruby
fippy has joined #ruby
In0perable has quit [Quit: All your buffer are belong to us!]
lapsa_ has quit [Quit: leaving]
ignorand has quit [Ping timeout: 272 seconds]
braincrash has joined #ruby
ignorand has joined #ruby
mtsd has quit [Quit: Leaving]
charrit69 has joined #ruby
<ignorand> phonenumber='8703443'\n regex = Regexp.new('(71|72|74|76|81|82|84|85|86|87|88|89)\d{5}').freeze\n phonenumber =~ regex\n (Why does this give 0 instead of true?)
<jhass> because Regex#=~ returns the position of the match or nil if there was none
<ignorand> sigh so it would also return 0 on 71123459 :'(
<jhass> match? returns true/false https://rubyapi.org/2.7/o/regexp#method-i-match-3F
<nakilon> just use 0, it works as true
<nakilon> in Ruby
bmurt has joined #ruby
TCZ is now known as Pitbull
Pitbull has quit [Quit: Diabe? tkwi w szczegó?ach]
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
jenrzzz has joined #ruby
Technodrome has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
davispuh has joined #ruby
Giorgio has joined #ruby
<Giorgio> hey. i need method to conver [[:a, 1], [:a, 2], [b: 3] to {a: [1,2], b: 3}
<nakilon> Giorgio [b: 3] or [:b, 3]?
<leftylink> I'm thinking about whether it'd give too much away if I said it but it's probably fine
<leftylink> &ri Enumerable#group_by
<Giorgio> sorry [:b, 3]
<leftylink> because that's a group_by if I ever saw one
<leftylink> with some extra stuff afterward, but still
<nakilon> &>> [[:a, 1], [:a, 2], [:b, 3]].group_by(&:first).map{ |k,g| [k, g.map(&:last)] }.to_h
<rubydoc> # => {:a=>[1, 2], :b=>[3]} (https://carc.in/#/r/9z97)
<nakilon> and then better rewrite the code that uses it afterwards
<leftylink> pinkpandabot: tell nakilon gg
<pinkpandabot> nakilon: goodgrief is: https://i.imgur.com/bf0ZlcD.jpg
<nakilon> better keep values of the same type
<Giorgio> [89] pry(main)> [[:a, 1], [:a, 2], [:b, 3]].group_by {|arr| arr[0] }
<Giorgio> => {:a=>[[:a, 1], [:a, 2]], :b=>[[:b, 3]]}
<leftylink> great, now it should be easy to see how to go from {:a=>[[:a, 1], [:a, 2]], :b=>[[:b, 3]]} to what you want.
<leftylink> &ri Hash#transform_values
<leftylink> especially with that
<nakilon> leftylink this isn't something such complex that one might just copypaste without understanding
<nakilon> transform_values isn't much handy here because you can't just give it some &:
<nakilon> .each would do instead
<nakilon> &>> [[:a, 1], [:a, 2], [:b, 3]].group_by(&:first).each_value{ |g| g.map! &:last }
<rubydoc> # => {:a=>[1, 2], :b=>[3]} (https://carc.in/#/r/9z99)
<nakilon> not that .transform_values is handy and I like it at all, since in most cases .each_value will do the job
<leftylink> well, at least each_value is shorter to type
<leftylink> that is definitely worth acknowledging
<nakilon> even the name is too long for no reason, could be .map_values
crankharder has joined #ruby
<leftylink> I must wonder why
supercoven has quit [Ping timeout: 260 seconds]
<nakilon> meh
<nakilon> "From our discussion, we concerned map_values is too close to map.values"
<nakilon> reverse_each?
<nakilon> why the same logic didn't apply?
<nakilon> each.with_index?
<nakilon> everyone in that thread were for map_values, lol
<nakilon> (another addition to why I don't like most of the changes in newer rubies)
charrit69 has quit [Quit: Konversation terminated!]
tsujp has quit [Read error: Connection reset by peer]
tsujp has joined #ruby
al2o3-cr has quit [Quit: WeeChat 2.9]
al2o3-cr has joined #ruby
cow[moo] has quit [Quit: Textual IRC Client: www.textualapp.com]
cow[moo] has joined #ruby
hiroaki has joined #ruby
TCZ has joined #ruby
fippy has quit [Read error: Connection reset by peer]
fippy has joined #ruby
fluxAeon_ has joined #ruby
Mia has quit [Read error: Connection reset by peer]
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
jobewan has quit [Quit: jobewan]
Mia has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has quit [Ping timeout: 260 seconds]
DaRock has quit [Ping timeout: 240 seconds]
s2013 has joined #ruby
bmurt has joined #ruby
baojg_ has joined #ruby
baojg has quit [Ping timeout: 264 seconds]
Glumetu has quit [Quit: Glumetu]
johnny56_ has joined #ruby
johnny56 has quit [Ping timeout: 240 seconds]
braincrash has quit [Ping timeout: 240 seconds]
ujjain has quit [Ping timeout: 256 seconds]
ChmEarl has joined #ruby
TCZ has quit [Quit: Diabe? tkwi w szczegó?ach]
helpa has quit [Remote host closed the connection]
<nakilon> weird, node.at_css("a") does not find the node <a> if it's the node itself
helpa has joined #ruby
Giorgio has quit [Quit: Leaving]
<ignorand> I have an array of arrays. I want to do a select where column 3 matches sometihng and column 4 matches something. Is json_data["data"].select{|x| x[3][/^5978718789$/] && x[2][/^10$/]} the most natural way to write it?
<adam12> ignorand: I'd probably use equality and not a regexp.
<adam12> ignorand: If the columns have any significance, you could extract them in the block arguments. .select { |_, foo, bar, _rest| }
<adam12> |_, _, foo, bar, _rest| rather
cthulchu_ has joined #ruby
<ignorand> @adam12 that solves my next question
<ignorand> I had to replace 5978718789 with a var
TomyWork has quit [Remote host closed the connection]
ellcs has joined #ruby
<nakilon> |_, _, foo, bar, |
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ua has quit [Ping timeout: 240 seconds]
<nakilon> but if you mean you want to find matching rows and edit values in them in place then you rather might want to do .each{ |x| x[3] = var if ... }
ellcs has quit [Ping timeout: 264 seconds]
fluxAeon_ has quit [Quit: Textual IRC Client: www.textualapp.com]
<nakilon> here x points to the row that you can edit, otherwise you'll not have a row reference; but if x[3] is a string and you want to replace it with another string then |_, _, foo, bar, | will work fine if you do the foo.replace(var) if ...
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cow[moo] has joined #ruby
ua has joined #ruby
akem_ has joined #ruby
dan64- has quit [Quit: ZNC - http://znc.in]
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
akem has quit [Ping timeout: 256 seconds]
cloud69 has quit [Quit: Connection closed for inactivity]
cow[moo] has joined #ruby
dan64 has joined #ruby
dfucci has quit [Ping timeout: 256 seconds]
dfucci has joined #ruby
braincrash has joined #ruby
dfucci has quit [Ping timeout: 260 seconds]
rippa has joined #ruby
andremedeiros has quit [Quit: ZNC 1.8.2 - https://znc.in]
shokohsc has joined #ruby
Emmanuel_Chanel has quit [Remote host closed the connection]
<ignorand> no clue what |_, _, foo, bar, | means, but I solved it for now
<ignorand> Thanks
Emmanuel_Chanel has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
al2o3-cr has quit [Quit: WeeChat 2.9]
mtsd has joined #ruby
al2o3-cr has joined #ruby
mtsd has quit [Quit: Leaving]
weaksauce has joined #ruby
dfucci has joined #ruby
bmurt has joined #ruby
dfucci has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
cd has joined #ruby
howdoi has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
bocaneri has quit [Read error: Connection reset by peer]
Rudd0 has quit [Ping timeout: 240 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has quit [Ping timeout: 240 seconds]
davispuh has quit [Ping timeout: 246 seconds]
qqqqqq has joined #ruby
<qqqqqq> Lets praise Allah; he is our God, thee one; he is the god of Moses; Noah; Jesus & Mohammed; he sent us our Book Quran, Monotheism is cleared by all prophets ~ We get heaven & happiness on earth by praying to the one god & by Saying No God except Allah & that Mohammed is the messenger of Allah. treat others as u like to be treated ---------;{@
qqqqqq has left #ruby [#ruby]
fippy has quit [Ping timeout: 260 seconds]
davispuh has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
bmurt has joined #ruby
impermanence has quit [Quit: Connection closed]
impermanence has joined #ruby
bamdad has quit [Remote host closed the connection]
ignorand has quit [Remote host closed the connection]
bamdad has joined #ruby
SeepingN has joined #ruby
powerhouse has quit [Quit: Leaving]
powerhouse has joined #ruby
braincrash has quit [Ping timeout: 272 seconds]
jenrzzz has joined #ruby
s2013 has joined #ruby
orbyt_ has joined #ruby
Inoperable has joined #ruby
desnudopenguino has joined #ruby
<apotheon> I wonder whether people think that popping up in a channel, quoting some kind of religious dogma, and disappearing again will ever have a convincing advocacy effect on the reader.
<apotheon> It seems like a ridiculously good way to make enemies rather than friends.
<desnudopenguino> they just trollin
Glumetu has joined #ruby
braincrash has joined #ruby
<Glumetu> hello is anyone familiar with nokogiri syntax for xml ? i need to knwo how to add an atribute like symb in this line <Country symb="US">00,00%</Country>
<havenwood> Glumetu: doc = Nokogiri::XML '<Country></Country>'; country = doc.at_css 'Country'; country['symb'] = '0
<havenwood> 0,00%'; xml.root.to_xml
<havenwood> Glumetu: #=> "<Country symb=\"00,00%\"/>"
<leftylink> I want to yy that
<leftylink> in fact I will
<leftylink> pinkpandabot: what's yy
<pinkpandabot> goodgrief is: https://i.imgur.com/bf0ZlcD.jpg
<leftylink> hmm, actually, I thought better of it, there's no need to bring others down when I've not been injured
leftylink has left #ruby ["I will reflect and return with a more mature image (self-imposed timeout to think about what I've done wrong)"]
<Glumetu> :)) thank you verry much
jenrzzz has quit [Ping timeout: 272 seconds]
braincrash has quit [Ping timeout: 265 seconds]
leftylink has joined #ruby
Rudd0 has joined #ruby
nakilon has quit [Ping timeout: 272 seconds]
nakilon has joined #ruby
jhass has quit [Quit: Bye]
jhass has joined #ruby
jenrzzz has joined #ruby
mokha has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
mokha has quit [Client Quit]
bamdad has quit [Ping timeout: 240 seconds]
yee has joined #ruby
bamdad has joined #ruby
<yee> is it possible to know when a defined method (def a; end) is about to be added to a class so that i can take some action?
<yee> thanks jhass
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jhass> yw
braincrash has joined #ruby
crankharder has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Glumetu has left #ruby [#ruby]
cliluw has joined #ruby
weaksauce has quit [Ping timeout: 264 seconds]
jenrzzz has quit [Ping timeout: 260 seconds]
gix has joined #ruby
jenrzzz has joined #ruby
drale2k has joined #ruby
yee has quit [Ping timeout: 256 seconds]
jenrzzz has quit [Ping timeout: 265 seconds]
drincruz has joined #ruby
dfucci has joined #ruby
jenrzzz has joined #ruby
dfucci has quit [Ping timeout: 240 seconds]
drincruz has quit [Ping timeout: 256 seconds]
jenrzzz has quit [Ping timeout: 272 seconds]