#ruby - 07 October 2017
« Back 1 day Forward 1 day »
[00:13:16] RickHull: the lib stuff is typically keyed to the minor version, i.e. just 2.2, even if written as 2.2.0
[00:18:51] Ohga: I'm trying to remind myself how ruby works, especially in the context of #initialize_copy . def initialize_copy other; super; @v = other ; # how do I get @v in other? end
[00:20:29] RickHull: other is an instance of the class that defines initialize_copy; that class must have a superclass, for the call to super() to work
[00:22:13] Ohga: yeah, that's what I were thinking of, I just wanted to check that I didn't miss something built into the syntax
[00:48:53] colin_: hey there. im currently trying to install sass using ruby, but everytime i run the command i get "failed to build gem native extension" + "extconf failed, exit code 1". can anyone help? i get this issue no matter how much i try.
[00:55:56] teatime: colin_: there's probably some more specific errors just above that, maybe gist it. perhaps you are missing a C compiler and libraries; e.g. if on debian or ubuntu, try `sudo apt-get install build-essential`
[01:02:26] teatime: colin_: might be `apt-get install ruby-dev` .. you can try that while I look something up
[01:04:43] teatime: colin_: on debian and derivatives, as a rule, you can install package libfoo which gets you what you need for an executable to use the Foo Library, but to you compile an executable that uses the Foo Library, you need libfoo-dev
[01:50:11] rubycoder37: I tried to get my fellow coworkers to change to ruby but they are all into python right now
[09:28:58] Nobun: Hi. someone can exactly explain me the "original ruby code snippet" here? http://dpaste.com/0BAD8KJ
[09:29:47] Nobun: with some guess I translated that snippet in a function, but I didn't understand exactly what |f| does and what is the purpose of the brackets there
[09:31:38] Nobun: I thinked that block of code usually have "begin" (for example def) and an "end" (wich is usually the keyword end)
[09:32:35] j416: the open method on File returns a file normally, but if you use it with a block like in your example, it will yield the file to the block
[09:35:02] Nobun: ok understood... so it is a special syntax that allows to handle the binary file and store it into an object with a safe open/close method. right?
[09:36:10] j416: Nobun: and also take into account what happens if "Marshal.load(f)" explodes (you'd probably want to close the file anyway=
[09:37:31] Nobun: it is more or less similar to python, when using "with open" against using simply using "open" (in the first case the file will be closed itself at the end of the block of code, in the second case you must close explicitly the file)
[09:40:32] Nobun: I'd like to add a code in the function wich will manage an error if the file was not successfully opened (it could be encripted. In that case the file will have no chance to be opened rightly)
[09:43:32] Nobun: sorry... is there something that says (if I manage the raise exception, i will end the execution of the script immediately... something like quit() or similar... but since I am planning to embed ruby I'd like to find something wich will stops the script WITHOUT stopping the host application)
[09:49:52] Nobun: yes... is is hard to find a decent documentation about embedding... I am searching around for days... the only thing I'm finding useful is: http://ruby-doc.com/docs/ProgrammingRuby/ (on ExtendingRuby chapter)
[09:50:51] Nobun: the application I am developing already embeds python and lua for different purposes, but I need also ruby becouse I need to have read access to some ruby marshal data files
[09:51:23] Nobun: compared to lua and python, documentation about embedding ruby is a bit trivial to be found :(
[10:03:03] matthewd: Nobun: I've heard things about https://silverhammermba.github.io/emberb/ -- it's mostly focused on extensions, but might contain some useful info?
[10:08:25] Nobun: yes. it seems very useful too, matthewd ... thank a lot (mainly the rescue2 part seems interesting. I could think about adding a general raise2 directly in the C++ code to eval the first script for safe execution and collecting the encripted failure)
[14:35:17] MystiqueEnigma: perhaps the name of the room should be changed from ruby to sleeping beauties :D
[22:46:57] rubycoder37: I like ruby and my coworkers like python more, they think python is faster and has more libraries for writing crawlers
[22:47:12] rubycoder37: I'm frustrated because I have to argue with people who aren't very bright all day
[23:00:28] mooe_: Is it okay to have a class that only has class methods? Or would it be better to do a singleton
[23:06:25] elomatreb: mooe_: FWIW the probably most popular ruby style guide recommends using modules if you only have class methods (but it's only a guide): https://github.com/bbatsov/ruby-style-guide#modules-vs-classes
[23:10:42] mooe_: Ooh I didnt know you could call module methods outside the module. Thats what I want. Thanks!