#ruby - 21 November 2018
« Back 1 day Forward 1 day »
[06:51:21] marz_d`ghostman_: I'm trying to declare a local variable inside a context block but it appears it is overriding a variable outside of it context though. https://gist.github.com/marzdgzmn/e7a1c04a62a7a79caba0410d06cf6dbd
[10:05:16] marz_d`ghostman_: Why does line 16 outputs the value defined in line 23 instead of value defined in line 4? https://gist.github.com/marzdgzmn/e7a1c04a62a7a79caba0410d06cf6dbd
[10:29:46] jhass: marz_d`ghostman_: because code outside of any blocks given to context, it or let is run before the one inside
[10:39:07] marz_d`ghostman_: so after line 23 is executed it exeutes the it block that puts the variable?
[10:39:18] jhass: no, from the top of the file line by line, but `it` does not run the block given to it right away, however `context` does
[10:45:29] jhass: marz_d`ghostman_: if we simplify what happens by a lot it'd look like this: https://carc.in/#/r/5l3l
[10:52:32] jhass: marahin: https://relishapp.com/rspec/rspec-core/docs/command-line/fail-fast-option
[10:53:51] jhass: yeah as said, it's something I'd give a try, not its purpose but I see potential for having the effect ;)
[16:44:44] marz_d`ghostman: is it good practice to create a singleton for database operation or create a module with a class instance for database?
[16:45:24] marz_d`ghostman: I just want to abstract it out so I could swap database all I have to do is modify the singleton class or module
[17:06:42] al2o3-cr: ffs, i know why i had `memory cost is too small` yesterday. i had `typealias "uint32_t", "unsigned char" lol
[21:10:11] havenwood: marz_d`ghostman: If there's a single instance of state, singleton class. If there's no state, module.
[21:13:12] havenwood: marz_d`ghostman: So I'd lean towards singleton class, since it sounds like you do have a single instance.