tuor

Activity Graph

Page 1 of 4 | Next »

2019-08-28

[09:22:45] tuor: has joined #ruby
[09:22:46] tuor: Remote host closed the connection
[09:22:46] tuor: has joined #ruby
[09:22:46] tuor: Changing host
[09:39:53] tuor: has joined #ruby
[09:43:49] tuor: Quit: Konversation terminated!
[09:58:13] tuor: has joined #ruby
[16:43:54] tuor: Quit: Konversation terminated!

2019-08-27

[11:03:05] tuor: Read error: Connection reset by peer
[11:04:23] tuor: has joined #ruby
[11:04:23] tuor: Changing host
[11:04:23] tuor: has joined #ruby
[20:31:00] tuor: Ping timeout: 248 seconds

2019-08-26

[12:43:21] tuor: has joined #ruby
[12:46:05] tuor: Hi, i wrote a little shell script which creates folders on a target system (container image build). Now I want to replace it, because only creating folders with mkdir -p is not the only thing I need any more: I want to be able t set permissions and owners. I tried to write it in ruby and it seems to work. What do you think, do you have any recommandations what I should change? https://dpaste.de/O2q0
[12:50:17] tuor: I changed from bash to ruby, because I wanted to be able to have structures, not only a dumm list or "associativ array" (comparable to a Hash with only Strings as values).
[12:50:20] tuor: phaul: thx!
[13:00:04] tuor: phaul: please explain why you would do that.
[13:01:51] tuor: I know I can use strings as keys in a hash. I used symbols, becaus I don't expect this foldername/folderpath to change and because I remember hash should use symbols not strings... I'm open to learning why not in this case. ;)
[13:03:22] tuor: Ahhh. Stuff like '/var/log/' + 'myservice'?
[13:03:40] tuor: hmm there is a point to it. :) thx.
[13:07:15] tuor: https://dpaste.de/kdYE changed it and added the possibility to not set permissions or owner or group
[13:19:11] tuor: NL3limin4t0r: OK thx.
[13:47:03] tuor: I changed it a little, should be a little bit better to read... https://dpaste.de/CyWv
[14:21:18] tuor: Ping timeout: 272 seconds
[20:11:12] tuor: has joined #ruby

2019-08-23

[07:20:12] tuor: has joined #ruby
[07:20:12] tuor: Changing host
[07:20:12] tuor: has joined #ruby
[07:33:55] tuor: Quit: Konversation terminated!
[07:38:06] tuor: has joined #ruby
[08:20:52] tuor: Ping timeout: 248 seconds

2019-08-22

[04:40:06] tuor: Ping timeout: 258 seconds
[05:38:20] tuor: has joined #ruby
[05:38:20] tuor: Changing host
[05:38:20] tuor: has joined #ruby
[05:39:13] tuor: Client Quit
[05:50:51] tuor: has joined #ruby
[12:02:33] tuor: Ping timeout: 245 seconds

2019-08-21

[14:23:11] tuor: has joined #ruby
[23:04:19] tuor: Read error: Connection reset by peer
[23:05:39] tuor: has joined #ruby

2019-08-16

[08:23:28] tuor: has joined #ruby
[09:28:47] tuor: Quit: Konversation terminated!

2019-08-14

[07:27:00] tuor: has joined #ruby
[07:27:00] tuor: Changing host
[07:27:00] tuor: has joined #ruby
[09:14:28] tuor: Read error: Connection reset by peer
[09:16:11] tuor: has joined #ruby
[09:16:11] tuor: Changing host
[09:16:11] tuor: has joined #ruby
[14:39:44] tuor: Quit: Konversation terminated!

2019-08-13

[09:20:27] tuor: has joined #ruby
[09:41:39] tuor: I just build a (little) gem. I can use it. I have a script as example usage in my projects bin folder. Does this example script get into the gem or only my code in lib? If I give my built gem (.gem) to someone can he use my example usage script? If yes, how?
[10:20:29] tuor: Ah nice is working. Thx.
[14:37:55] tuor: Quit: Konversation terminated!

2019-08-08

[10:55:57] tuor: has joined #ruby
[14:44:34] tuor: Quit: Konversation terminated!

2019-08-07

[08:43:27] tuor: has joined #ruby
[08:48:29] tuor: Quit: Konversation terminated!
[09:54:46] tuor: has joined #ruby
[09:54:46] tuor: Changing host
[09:54:46] tuor: has joined #ruby
[15:09:41] tuor: Quit: Konversation terminated!

2019-08-06

[11:49:46] tuor: has joined #ruby
[11:54:46] tuor: Hi, is there something like shellcheck for bash for ruby?
[12:52:35] tuor: yea ah nice. thx.
[13:14:02] tuor: Quit: Konversation terminated!

2019-08-05

[07:16:06] tuor: has joined #ruby
[12:46:34] tuor: Quit: Konversation terminated!

2019-08-02

[13:31:14] tuor: has joined #ruby
[13:48:50] tuor: Hi, I would like to list all objects in a running ruby programm. How can I do that?
[13:50:05] tuor: I get a 'NoMethodError'
[13:54:37] tuor: I'm close: `ObjectSpace.each_object { |o| pp o } ` but it prints the complete objects, I only want the object names...
[13:55:56] tuor: like: `a = [ 'q', 'w' ]` should be rpinted as just 'a' or even 'a => String'
[14:01:17] tuor: OK. How can I print all variables?
[14:41:38] tuor: phaul: ah thx!
[14:42:01] tuor: `self.instance_variables` is good. :)
[14:42:08] tuor: got what I needed.
[14:43:31] tuor: can I shorten? `"asdfqwerzxcv".gsub(/^a/, '').gsub(/qwer/, '').gsub(/v$/, '')`
[15:15:28] tuor: Quit: Konversation terminated!

2019-07-31

[12:46:43] tuor: has joined #ruby
[15:02:54] tuor: Quit: Konversation terminated!

2019-07-30

[07:32:29] tuor: has joined #ruby
[07:45:03] tuor: Quit: Konversation terminated!

2019-07-29

[14:07:20] tuor: has joined #ruby
[15:02:36] tuor: Quit: Konversation terminated!

2019-07-26

[11:21:05] tuor: has joined #ruby
[12:55:20] tuor: Quit: Konversation terminated!

2019-07-25

[11:13:37] tuor: has joined #ruby
[14:42:24] tuor: Quit: Konversation terminated!

2019-07-23

[07:36:56] tuor: has joined #ruby
[14:13:37] tuor: Quit: Konversation terminated!

2019-07-19

[05:31:12] tuor: Ping timeout: 272 seconds
[06:52:01] tuor: has joined #ruby
[06:52:01] tuor: Changing host
[06:52:01] tuor: has joined #ruby
[06:52:30] tuor: Client Quit

2019-07-18

[10:03:37] tuor: has joined #ruby

2019-07-16

[06:10:55] tuor: has joined #ruby
[11:11:20] tuor: Hi, I loaded a YAML file into an object called 'lxc'. It contains a list containers and a lot of information fields about the containers. Know I would like to look for keys in the object. LXC is an arary, but is shurely containing other arrays, hashes, strings. I would like to print the array entry which contains a hash with a key name matching a regex. I tried to google recursiv lookup but it seems, it's more complicated then I thought.
[11:18:22] tuor: I tried to list all names like this, but I get only one name: `names = Array.new; lxc.each { |item| names =+ item['container']['name'] }`
[11:19:29] tuor: ah with map instead of each it works. :) I have to check documentation about map and each...
[11:26:09] tuor: I'll read your link. :) thx.
[11:26:27] tuor: I found now a way (with try and error :) )
[11:26:32] tuor: imgs = Hash.new; lxc.map { |item| names[item['container']['name']]=item['container']['config']['image.description'] }
[11:26:53] tuor: but that's not very readable in my opinion^^
[11:32:07] tuor: i tried dig and it's longer but more readable now: `imgs = Hash.new; lxc.map { |item| name=item.dig('container', 'name'); img=item.dig('container', 'config', 'image.description'); imgs[name]=img }`
[12:33:02] tuor: Remote host closed the connection

2019-07-15

[09:48:15] tuor: has joined #ruby
[09:49:29] tuor: hi, can this be shortened? ruby -e 'list = []; while gets; list << $_.split[1]; end; puts list.join(" ")'
[11:01:56] tuor: manveru: how does your second version work? I men it's nice (yes I don't mind some spaces at the end). The first is nice and still shorter then mine^^
[11:09:51] tuor: the -n is clear. but the part at the end I don't know what it is: `, " "` I google this topic befor and found your second solution but only without the last part.
[11:29:17] tuor: print not puts
[11:29:27] tuor: how simple. :)
[11:30:16] tuor: Thx! both
[15:07:13] tuor: Quit: Konversation terminated!

2019-07-11

[08:28:36] tuor: has joined #ruby
[15:32:44] tuor: Quit: Konversation terminated!

2019-07-10

[07:44:45] tuor: has joined #ruby
[16:28:17] tuor: Quit: Konversation terminated!

2019-07-09

[07:48:06] tuor: has joined #ruby
[14:52:16] tuor: Quit: Konversation terminated!

2019-07-08

[12:36:30] tuor: has joined #ruby
[14:52:38] tuor: Quit: Konversation terminated!
[16:38:35] tuor: has joined #ruby
[16:54:16] tuor: Ping timeout: 272 seconds
[17:36:03] tuor: has joined #ruby
[17:54:04] tuor: Ping timeout: 246 seconds

2019-07-05

[06:21:07] tuor: has joined #ruby
[09:41:53] tuor: Ping timeout: 248 seconds
[15:29:29] tuor: has joined #ruby
[15:29:29] tuor: Changing host
[15:29:29] tuor: has joined #ruby
[15:35:25] tuor: Quit: Konversation terminated!

2019-07-04

[06:45:58] tuor: has joined #ruby
[15:36:33] tuor: Quit: Konversation terminated!

2019-07-03

[04:19:19] tuor: has joined #ruby
[04:25:01] tuor: Quit: Konversation terminated!
[12:52:16] tuor: has joined #ruby
[16:17:10] tuor: Ping timeout: 272 seconds

2019-07-02

[05:48:53] tuor: has joined #ruby
[05:48:53] tuor: Changing host
[05:48:53] tuor: has joined #ruby
[05:55:37] tuor: Quit: Konversation terminated!
[05:55:48] tuor: has joined #ruby
[05:55:48] tuor: Changing host
[05:55:48] tuor: has joined #ruby
[17:12:33] tuor: Ping timeout: 245 seconds

2019-07-01

[08:14:37] tuor: has joined #ruby
[14:15:45] tuor: Ping timeout: 244 seconds

2019-05-03

[12:29:45] tuor: has joined #ruby
[14:36:13] tuor: Quit: Konversation terminated!

2019-05-02

[07:46:24] tuor: has joined #ruby
[08:08:51] tuor: Read error: Connection reset by peer
[08:10:13] tuor: has joined #ruby
[08:10:13] tuor: Changing host
[08:10:13] tuor: has joined #ruby
[10:43:22] tuor: Ping timeout: 245 seconds
[10:44:30] tuor: has joined #ruby
[10:44:30] tuor: Changing host
[10:44:30] tuor: has joined #ruby
[10:50:44] tuor: Ping timeout: 252 seconds
[11:10:30] tuor: has joined #ruby
[11:10:30] tuor: Changing host
[11:10:30] tuor: has joined #ruby
[11:12:00] tuor: Client Quit

2019-05-01

[12:31:49] tuor: has joined #ruby
[13:01:36] tuor: Quit: Konversation terminated!

2019-04-26

[09:42:30] tuor: has joined #ruby
[14:05:16] tuor: Quit: Konversation terminated!

2019-04-25

[11:26:15] tuor: has joined #ruby
[11:50:28] tuor: Ping timeout: 245 seconds

2019-04-24

[06:03:18] tuor: has joined #ruby
[12:19:41] tuor: Quit: Konversation terminated!
[12:20:05] tuor: has joined #ruby
[13:53:29] tuor: Ping timeout: 258 seconds

2019-04-12

[11:15:38] tuor: has joined #ruby
[13:39:03] tuor: Quit: Konversation terminated!

2019-04-11

[06:21:41] tuor: has joined #ruby
[07:58:13] tuor: havenwood: thx for all your explanation. I went trew it again. I think I understand the idea, but I still don't understand what symbols exactly are and how they work.
[09:10:02] tuor: Ping timeout: 245 seconds
[09:11:27] tuor: has joined #ruby
[09:11:27] tuor: Changing host
[09:11:27] tuor: has joined #ruby
[09:23:47] tuor: Ping timeout: 245 seconds
[10:17:43] tuor: has joined #ruby
[10:17:43] tuor: Changing host
[10:17:43] tuor: has joined #ruby
[13:04:50] tuor: A symbol is an object which can be converted to a string or integer and is immutable. Is this all to know or are there other special things about symbols?
[13:15:30] tuor: Ah ok. So when to use them? What it the purpose or why not just using strings?
[13:22:52] tuor: OK. makes sense.
[13:52:13] tuor: Quit: Konversation terminated!
[13:53:01] tuor: has joined #ruby
[17:49:02] tuor: Quit: Konversation terminated!

2019-04-10

[12:37:30] tuor: has joined #ruby
[12:40:00] tuor: Hi, I'm currently reading https://docs.ruby-lang.org/en/2.6.0/OptionParser.html and wondering what this line exactlly doies: `Options = Struct.new(:name)`
[12:43:36] tuor: I don't know what an accessor is and where this class is defined (is Struct a class provided by ruby it self?)
[12:46:03] tuor: so Options.name would then be a Struct?
[12:48:25] tuor: OK let me try.
[13:24:30] tuor: Cork: I played a bit around. Now I don't understand why this code prints 'Class': `options = Struct.new(:name); puts options.class`
[14:04:25] tuor: Cork: so options is an instance of the class Class and has an attribute called name?
[14:18:41] tuor: Ah now, I'm creating a new class called Option.
[14:19:08] tuor: I was thinking I am instanciating a Class not creating a new class. Thats a big difference... :)
[14:21:38] tuor: I read your paste. I did understand I think even your metho to_s with the array to comma seperated words in the string.
[15:12:38] tuor: Ping timeout: 250 seconds

2019-03-12

[08:30:14] tuor: has joined #ruby
[08:31:19] tuor: Hi, this is how my code is right now: https://dpaste.de/ok5i
[08:33:17] tuor: Are there any "don't do that!" in it? Or do you have any sugsetion what I should do differently for reason x? I wrote ruby befor like 3 or 4 years ago and learned a lot with this channel. But don't hit me if I can't remember all of what you told me. ;)
[08:33:55] tuor: So I'm still a beginner. ;)
[10:00:40] tuor: Thx for your comments, this is what I got up with: https://dpaste.de/C0u4
[10:29:34] tuor: I have the rescue part in my code, how can I fail in a part of the script and jump to that rescue part. Like `error = 'failure reason; go to rescue`
[10:38:31] tuor: ljarvis: I'm trying to put it into a function. but how can I let the function fail? If I'm not happy with the given path the function should fail.
[10:44:17] tuor: I tried it but it doesn't fail on an empty string: https://dpaste.de/QL2u
[10:52:10] tuor: It is working like this: https://dpaste.de/tWbz
[10:52:38] tuor: ACTION is going afk, but come back later and will read if someone mentions him!
[13:01:12] tuor: I improved failure handling. How does it look now? https://dpaste.de/o4Dt
[14:23:31] tuor: phaul: I'll read and try to understand. ;)
[14:24:31] tuor: ah I understand. This would be a lot better then what I do. :) I will change it. thx!
[14:32:05] tuor: done and some other small changes (comments most of it): https://dpaste.de/58qd
[15:07:46] tuor: Thx for all your help today! I'll leave now. bye.
[15:07:54] tuor: has left #ruby: ("cu")

2019-03-11

[09:51:39] tuor: has joined #ruby
[09:53:39] tuor: Hi, this is my code: https://dpaste.de/SZpp#L
[10:01:28] tuor: What I want to do is: if STDIN has a key path with a non empty string as value, make a Pathname with this string. I want to add to this code, that if path doesn't get assigned a pathname, path gets a default pathname. How should I do that? I could do it like this: https://dpaste.de/AHn0
[10:02:00] tuor: How would you do it?
[10:08:13] tuor: hmm ||= seems nice. I'll try. :)
[12:03:15] tuor: Ping timeout: 246 seconds

2019-03-07

[08:37:11] tuor: has joined #ruby
[08:38:01] tuor: hi, when should I use double quotes and when should I use single quotes for strings?
[08:56:21] tuor: It seems no general rule all agree on. But is my assumption right, single quotes are performing better?
[08:57:49] tuor: hmm ok. thx!
[14:35:27] tuor: Hi, is there ruby a option which passes a string as STDIN to a script? like ruby myscript --stdin '{"secret":"asdf"}'
[14:55:37] tuor: I can't call the ruby binary with bash. It's called by my IDE RubyMine and RubyMine doesn't support redirection of STDIN... So I am looking for some other way. Right Now I use STDIN.reopen('/tmp/path.json') in the beginning of my ruby script, but I have to comment it out befor each git commit. That's not very nice.
[15:48:40] tuor: How can I test if a passed object to a method is of a specific class?
[15:53:28] tuor: let me try.
[15:55:00] tuor: is working thx!
[16:22:11] tuor: ACTION can't remember having see === befor.
[16:22:22] tuor: s/see/seen/
[16:26:15] tuor: #is_a? and === seem both to be fine to me. :)
[16:30:31] tuor: I like the #is_a? variation, in my opinion it's more readable.
[16:35:54] tuor: has left #ruby: ("Thx for all your help today! cu")