guardian

Activity Graph

Page 1 of 3 | Next »

2019-07-23

[07:23:07] guardian: Ping timeout: 245 seconds
[07:24:17] guardian: has joined #ruby

2019-07-19

[05:49:12] guardian: Ping timeout: 245 seconds
[05:49:22] guardian: has joined #ruby

2019-07-13

[17:02:47] guardian: Remote host closed the connection
[17:03:31] guardian: has joined #ruby

2019-07-07

[06:08:05] guardian: *.net *.split
[06:18:30] guardian: has joined #ruby

2019-06-26

[09:47:46] guardian: Remote host closed the connection
[10:08:54] guardian: has joined #ruby

2019-04-25

[11:48:01] guardian: Remote host closed the connection
[11:50:04] guardian: has joined #ruby

2019-04-13

[16:50:14] guardian: *.net *.split

2019-04-05

[22:01:18] guardian: Ping timeout: 246 seconds
[22:01:21] guardian: has joined #ruby

2019-03-18

[06:19:31] guardian: Remote host closed the connection
[13:38:33] guardian: has joined #ruby

2019-02-08

[04:08:47] guardian: Ping timeout: 240 seconds
[04:14:53] guardian: has joined #ruby
[05:08:52] guardian: Ping timeout: 250 seconds
[05:46:55] guardian: has joined #ruby
[05:59:40] guardian: Ping timeout: 246 seconds
[06:08:36] guardian: has joined #ruby
[16:22:01] guardian: Quit: Coyote finally caught me
[16:22:26] guardian: has joined #ruby

2019-02-04

[03:51:59] guardian: Remote host closed the connection
[12:21:44] guardian: has joined #ruby

2018-12-14

[07:38:56] guardian: Remote host closed the connection
[21:06:42] guardian: has joined #ruby

2018-12-05

[18:02:39] guardian: hello, when using ERB with trim_mode set to '<>', is it expected that the input string "<%= 'foo' %>\n<%= 'bar' %>' produces "foobar" ?
[18:13:42] guardian: in fact where could I get more information about trim_mode and consequences of each value?

2018-10-25

[06:43:03] guardian: has joined #ruby

2018-10-24

[18:48:53] guardian: *.net *.split

2018-10-09

[21:09:31] guardian: Remote host closed the connection

2018-10-06

[10:36:11] guardian: can someone please remind me how to solve that
[10:36:19] guardian: I'm debugging some code through rspec
[10:36:29] guardian: and I want to stop in pry with require 'pry' ; binding.pry
[10:36:42] guardian: except that rspec keeps outputing the current progress in the terminal
[10:36:48] guardian: it looks like it has a monitoring thread doing so
[10:36:53] guardian: is there a way to disable it?

2018-09-10

[15:15:45] guardian: I have a question about idiomatic ruby. Let's say I want a helper function that returns either :foo or :bar. And I want it to be called target. Should it be target or target? ?
[15:16:23] guardian: what yo use question marks then?
[15:16:31] guardian: when it returns a bool?
[15:19:30] guardian: thanks havenwood
[15:19:47] guardian: I have another question while I'm at it. Why don't Symbols expose include? or start_with? functions?
[15:28:09] guardian: thanks havenwood, appreciated

2018-09-09

[18:48:32] guardian: has joined #ruby
[18:48:56] guardian: hello, what's the idiomatic way to use h.dig(:foo, :bar) and set it to true only if it's nil

2018-08-19

[10:21:35] guardian: has joined #ruby

2018-08-18

[15:17:21] guardian: Remote host closed the connection

2018-07-20

[00:07:15] guardian: *.net *.split
[00:15:38] guardian: has joined #ruby

2018-07-15

[10:22:25] guardian: Remote host closed the connection
[10:47:35] guardian: has joined #ruby

2018-06-19

[11:21:07] guardian: has joined #ruby

2018-06-18

[23:58:59] guardian: Remote host closed the connection

2018-05-29

[02:47:19] guardian: *.net *.split
[02:48:04] guardian: has joined #ruby

2018-05-14

[11:56:39] guardian: has joined #ruby
[11:58:46] guardian: Remote host closed the connection
[11:59:06] guardian: has joined #ruby
[12:00:28] guardian: Remote host closed the connection
[12:00:49] guardian: has joined #ruby

2018-05-13

[21:16:57] guardian: Remote host closed the connection

2018-05-02

[23:16:47] guardian: *.net *.split

2018-04-25

[12:25:47] guardian: *.net *.split
[12:27:20] guardian: has joined #ruby
[15:01:18] guardian: *.net *.split
[15:03:17] guardian: has joined #ruby

2018-04-10

[02:54:26] guardian: Read error: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number
[13:41:21] guardian: has joined #ruby

2018-04-05

[00:51:15] guardian: *.net *.split

2018-03-01

[08:22:46] guardian: Remote host closed the connection
[08:28:09] guardian: has joined #ruby

2018-02-23

[07:53:26] guardian: has joined #ruby
[08:11:51] guardian: *.net *.split
[08:28:48] guardian: has joined #ruby

2018-02-20

[09:45:02] guardian: I have text file in which I have "groups of lines separated by an empty line". Is there an idiomatic way of converting that into an array of arrays of strings?
[09:55:34] guardian: sounds like it
[09:56:07] guardian: now the file weights 3GB, this is the output from the fdupes tool, maybe I shouldn't load all that into memory :D
[10:00:26] guardian: well File.read('dupes.txt') doesn't work...
[10:00:31] guardian: but the error is cryptic
[10:00:32] guardian: Errno::EINVAL (Invalid argument @ io_fread - dupes.txt)
[10:00:49] guardian: I thought I messed the file name but File.exists?('dupes.txt') returns true
[10:06:01] guardian: thanks al2o3-cr and tbuehlmann, IO.foreach('dupes.txt', "\n\n") { |lines| lines.split } works for me. It gives me an array of strings at each top level iteration

2018-02-19

[20:32:51] guardian: hello, this is a thing difficult to google: I'm launching a test with bundle exec m ./path/to/test.rb. Inside test.rb I try to use pry but when launching the test the debugger doesn't break. Does someone know how to debug such tests?
[20:39:51] guardian: dminuoso: nope it doesn't for some reason

2018-02-07

[11:57:39] guardian: Quit: Coyote finally caught me
[11:58:02] guardian: has joined #ruby
[12:22:20] guardian: Quit: Coyote finally caught me
[12:23:02] guardian: has joined #ruby
[12:33:29] guardian: Quit: Coyote finally caught me
[12:33:52] guardian: has joined #ruby

2018-01-09

[07:48:04] guardian: hello, I'm trying to debug a test in some project (not my project). I launch the test using bundle exec m ./path/to/test.rb
[07:48:15] guardian: and inside test.rb I added require 'pry' ; binding.pry
[07:48:26] guardian: but the debugger doesn't kick in :(
[07:48:36] guardian: anyone ever succeeded in using pry + m ?

2018-01-02

[09:38:25] guardian: Quit: Coyote finally caught me
[09:49:14] guardian: has joined #ruby
[09:49:57] guardian: Client Quit
[11:02:47] guardian: has joined #ruby
[11:16:21] guardian: Quit: Coyote finally caught me
[11:19:24] guardian: has joined #ruby
[11:26:25] guardian: Quit: Coyote finally caught me
[11:29:22] guardian: has joined #ruby

2017-12-14

[16:02:01] guardian: hello, when I use =~ to compare a string with a regular expression
[16:02:08] guardian: are match variables set for capture groups?

2017-12-13

[16:39:32] guardian: hello, I have a string which is "hello #{foo}". There are reasons that makes it containing #{foo} and not %{foo}. Which means I can't use str % arg -> new_str
[16:39:42] guardian: what's my best bet then?
[16:40:07] guardian: also I control the content of the foo variable and I trust it not to be malicious. It's not user provided
[16:40:22] guardian: I notived eval '"' + s + '"' does what I want but it looks weird
[16:40:28] guardian: is there another way? maybe better?
[16:44:05] guardian: https://pastebin.ubuntu.com/26177616/
[16:44:13] guardian: is there a more elegant way of doing this?
[16:48:36] guardian: dminuoso: thanks will look into it
[16:48:55] guardian: dminuoso: also I failed the pastebin, should have been s = '#{foo}' of course
[16:50:19] guardian: sure I do, I control what's inside, and I need the dynamic nature
[16:51:31] guardian: I would have preferred string formatting with %{} but there's another constraint that makes it be s='#{foo}' and not s='%{foo}'

2017-12-09

[05:06:08] guardian: *.net *.split
[05:15:09] guardian: has joined #ruby

2017-12-07

[14:48:24] guardian: *.net *.split
[14:55:06] guardian: has joined #ruby

2017-11-13

[13:42:01] guardian: hello, if I do def foo(h = {}, x) -- I can't call it this way: foo(bar: 'baz', 'x')
[13:42:18] guardian: is there a way to approach "first parameters end up in the hash, last one end up in x" ?
[13:42:26] guardian: not sure if Ruby syntax allows that
[14:06:44] guardian: that's what I expected

2017-11-11

[11:18:56] guardian: Quit: Coyote finally caught me
[11:19:30] guardian: has joined #ruby
[11:21:22] guardian: Client Quit
[11:21:56] guardian: has joined #ruby
[11:22:01] guardian: Client Quit
[11:22:35] guardian: has joined #ruby

2017-11-09

[14:22:15] guardian: hello, is there a quick way given a string to only keep numbers / digits in it?
[15:58:10] guardian: tobiasvl: thank you!

2017-11-07

[15:34:54] guardian: if there a shorter way to write if !(baz = foo[bar]).nil? then return baz
[15:39:19] guardian: return foo[bar] is foo[bar]
[15:39:43] guardian: return foo[bar] if foo[bar]
[15:39:59] guardian: not sure how people write these early returns, I'm a bit annoyed by the double evaluation
[15:40:28] guardian: didn't know I can write it this way
[15:40:37] guardian: I'm a ruby noob

2017-11-06

[17:13:52] guardian: has joined #ruby
[17:18:27] guardian: hello, I'm looking for an elegant/idiomatic of converting an array of strings and hashes into another array, where flat strings are grouped. Since I'm not sure how to express it I created a paste: https://paste.debian.net/994433/
[17:40:01] guardian: let me have look
[18:01:12] guardian: I came up with .chunk { |e| e.is_a?(String) }.to_a.map { |e| e[0] ? { :nil => e[1] } : e[1] }.flatten
[18:01:16] guardian: what do you think?
[18:06:18] guardian: dminuoso: it works
[19:12:04] guardian: dminuoso: why did you say it can't possibly work? I'm curious
[19:25:02] guardian: dminuoso: I see
[19:26:00] guardian: dminuoso: thanks for your hawk eye :)

2017-10-16

[19:18:37] guardian: Quit: Coyote finally caught me

2017-10-15

[20:19:25] guardian: Quit: Coyote finally caught me
[20:40:58] guardian: has joined #ruby
[20:44:26] guardian: Quit: Coyote finally caught me
[21:27:38] guardian: has joined #ruby
[21:29:21] guardian: Quit: Coyote finally caught me
[21:50:54] guardian: has joined #ruby

2017-10-13

[13:59:47] guardian: hello, is there an itiomatic oneliner way to match a string against a regex with 1 capture group, the result would be the captured group on match otherwise nil
[14:30:12] guardian: elomatreb: nice

2017-10-12

[20:49:50] guardian: hello, I'm playing with Rouge, writing a formatter but I'm a beginner
[20:50:04] guardian: I'm building an array of lines (strings) out of streamed tokens: https://pastebin.ubuntu.com/25728449/
[20:50:25] guardian: is there a more idiomatic way to write this? instead of appending to a string and an array?
[20:54:52] guardian: likely already better https://pastebin.ubuntu.com/25728476/
[20:54:58] guardian: ah havenwood thanks!
[20:55:22] guardian: that's cool, I love when I learn things. Thanks for caring :) <3

2017-10-08

[11:21:07] guardian: Quit: Coyote finally caught me
[11:32:01] guardian: has joined #ruby

2017-10-07

[08:46:18] guardian: Quit: Coyote finally caught me
[08:51:53] guardian: has joined #ruby

2017-10-06

[12:46:38] guardian: has joined #ruby
[12:46:47] guardian: hello, I have a beginner question
[12:47:00] guardian: I have foo(*bars) that takes an undefined number of parameters
[12:47:11] guardian: and I found myself trying to do def foo(*bars, params = {})
[12:47:23] guardian: which obviously doesn't work
[12:47:29] guardian: what's the usual way to solve this?
[12:48:02] guardian: I don't think I understand what it does
[12:48:39] guardian: yep starting with Ruby 2.3 right?
[12:48:48] guardian: but foo(*bar, **s) I don't get it
[12:50:14] guardian: SyntaxError: (irb):7: syntax error, unexpected '=', expecting ')'
[12:50:24] guardian: when trying to def foo(*bar, params = {})
[12:50:45] guardian: running ruby 2.4.2
[12:52:31] guardian: so def foo(*bars, **params) is the new Ruby 2.3 syntax right?
[12:53:08] guardian: and there's no way if targetting Ruby < 2.3 correct?
[12:54:00] guardian: I prefer the new way obviously
[12:54:12] guardian: so likely, post Ruby 2.3 people don't write params = {} style anymore?

2017-09-24

[18:47:51] guardian: has left #ruby: ("WeeChat 1.9")

2017-09-22

[15:36:22] guardian: hello, is there a way to do something like self&.foo('bar') that would call a method #foo() only if it exists?
[15:36:40] guardian: with ruby >= 2.3
[15:43:39] guardian: I don't get it
[15:44:24] guardian: what I want is something nicer than (self.respond_to?(:foo) && foo()) || ...
[15:44:31] guardian: I just discovered respond_to?
[15:45:06] guardian: the example is contrieved but basically I want to tentatively call a method
[15:45:22] guardian: and if it doesn't exist, it should yield so I can chain
[15:48:55] guardian: no, I'm not using Rails
[15:48:59] guardian: thanks for the help anyways

2017-09-20

[10:19:02] guardian: has joined #ruby
[10:20:00] guardian: I believe I've seen somewhere a way to access foo[:bar][:baz] where foo is a hash and it would return nil without raising if foo[:bar] doesn't exist to begin with
[10:20:02] guardian: does that ring a bell?
[10:21:16] guardian: which ruby version do I need for that?
[10:21:23] guardian: well how do I check which ruby version introduced something?
[14:07:49] guardian: is there an easy way to kindof negate the match with string.gsub? like I would like it to stop on "foo" and "baz" when the input string is "foobarbaz"
[14:08:21] guardian: in other word "it's negating" /bar/
[14:25:29] guardian: given "foobarbaz" I want to stop on "foo" and "bar" and let me replace each
[15:34:33] guardian: Quit: Coyote finally caught me
[15:45:28] guardian: has joined #ruby

2017-09-16

[12:51:59] guardian: Quit: Coyote finally caught me

2017-09-15

[16:24:56] guardian: Quit: Coyote finally caught me
[16:26:40] guardian: has joined #ruby
[16:26:51] guardian: Client Quit
[17:09:52] guardian: has joined #ruby

2017-09-14

[06:04:41] guardian: Remote host closed the connection
[14:12:35] guardian: has joined #ruby

2017-09-07

[16:39:26] guardian: has joined #ruby
[16:39:42] guardian: hello is there an easy oneliner that lets me join path fragments with forward slashes even on windows?
[16:46:10] guardian: eam: I thought File.join would use '\' on windows :)

2017-08-10

[11:09:13] guardian: Quit: Coyote finally caught me

2017-08-08

[14:46:18] guardian: Read error: Connection reset by peer
[18:42:12] guardian: has joined #ruby

2017-08-04

[13:14:14] guardian: hello, when using to_yaml on a hash, when keys are symbols they are serialized with a leading ':'
[13:14:16] guardian: is there a way to avoid that?
[14:28:39] guardian: sounds like the only option

2017-08-02

[15:41:09] guardian: has joined #ruby
[15:41:23] guardian: hello, what's idiomatic to write a string to a file in ruby? File.open with a block returning the string?
[16:20:09] guardian: I tried to google File.write but I only found the instance method
[16:20:14] guardian: (noob here)

2017-07-17

[08:15:21] guardian: has left #ruby: ("WeeChat 1.9")

2017-07-09

[14:49:32] guardian: Disconnected by services
[14:51:04] guardian: has joined #ruby

2017-07-04

[19:03:47] guardian: Remote host closed the connection
[19:31:22] guardian: has joined #ruby

2017-06-20

[00:17:39] guardian: *.net *.split
[07:25:28] guardian: Ping timeout: 240 seconds
[07:28:39] guardian: has joined #ruby