« Back to channel list

#ruby - 03 October 2018

Forward 1 day »
[00:38:42] helpa: has joined #ruby
[00:40:51] helpa: has joined #ruby
[00:42:47] helpa: has joined #ruby
[00:44:48] helpa: has joined #ruby
[00:46:49] helpa: has joined #ruby
[00:48:50] helpa: has joined #ruby
[00:50:50] helpa: has joined #ruby
[00:52:54] helpa: has joined #ruby
[00:53:52] Nicmavr: has joined #ruby
[00:54:57] helpa: has joined #ruby
[00:56:58] helpa: has joined #ruby
[00:58:58] helpa: has joined #ruby
[01:01:00] helpa: has joined #ruby
[01:03:01] helpa: has joined #ruby
[01:03:15] tAn: has joined #ruby
[01:05:02] helpa: has joined #ruby
[01:07:01] helpa: has joined #ruby
[01:09:02] helpa: has joined #ruby
[01:11:04] helpa: has joined #ruby
[01:13:06] helpa: has joined #ruby
[01:13:22] arkaros: has joined #ruby
[01:15:05] helpa: has joined #ruby
[01:17:06] helpa: has joined #ruby
[01:19:07] helpa: has joined #ruby
[01:21:08] helpa: has joined #ruby
[01:22:36] orbyt_: has joined #ruby
[01:23:08] helpa: has joined #ruby
[01:25:10] helpa: has joined #ruby
[01:27:12] helpa: has joined #ruby
[01:29:11] helpa: has joined #ruby
[01:31:12] helpa: has joined #ruby
[01:35:13] helpa: has joined #ruby
[01:37:14] helpa: has joined #ruby
[01:39:16] helpa: has joined #ruby
[01:41:15] helpa: has joined #ruby
[01:42:35] dar123: has joined #ruby
[01:43:16] helpa: has joined #ruby
[01:45:16] helpa: has joined #ruby
[01:47:17] helpa: has joined #ruby
[01:49:19] helpa: has joined #ruby
[01:51:20] helpa: has joined #ruby
[01:52:17] mzo: has joined #ruby
[01:53:21] helpa: has joined #ruby
[01:55:20] helpa: has joined #ruby
[01:57:21] helpa: has joined #ruby
[01:57:53] cagomez: has joined #ruby
[01:58:35] kapil____: has joined #ruby
[01:59:22] helpa: has joined #ruby
[02:01:24] helpa: has joined #ruby
[02:02:36] za1b1tsu: has joined #ruby
[02:03:24] helpa: has joined #ruby
[02:05:25] helpa: has joined #ruby
[02:07:25] helpa: has joined #ruby
[02:09:02] akem: has joined #ruby
[02:09:26] helpa: has joined #ruby
[02:11:27] helpa: has joined #ruby
[02:13:09] faitswulff: has joined #ruby
[02:13:28] helpa: has joined #ruby
[02:13:32] akem: has joined #ruby
[02:15:28] helpa: has joined #ruby
[02:17:30] helpa: has joined #ruby
[02:19:29] helpa: has joined #ruby
[02:21:30] helpa: has joined #ruby
[02:21:41] queelius: has joined #ruby
[02:22:42] clemens3: has joined #ruby
[02:22:54] WA9ACE: has joined #ruby
[02:23:33] helpa: has joined #ruby
[02:25:31] helpa: has joined #ruby
[02:27:33] helpa: has joined #ruby
[02:29:34] helpa: has joined #ruby
[02:31:34] helpa: has joined #ruby
[02:33:35] helpa: has joined #ruby
[02:35:37] helpa: has joined #ruby
[02:37:36] helpa: has joined #ruby
[02:39:39] helpa: has joined #ruby
[02:39:59] akem: has joined #ruby
[02:41:40] helpa: has joined #ruby
[02:43:39] helpa: has joined #ruby
[02:45:41] helpa: has joined #ruby
[02:47:40] helpa: has joined #ruby
[02:49:41] helpa: has joined #ruby
[02:51:42] helpa: has joined #ruby
[02:53:30] akem: has joined #ruby
[02:53:44] helpa: has joined #ruby
[02:55:47] helpa: has joined #ruby
[02:56:41] elphe: has joined #ruby
[02:57:47] helpa: has joined #ruby
[02:58:50] darkhanb: has joined #ruby
[02:58:53] dviola: has joined #ruby
[02:59:33] Freshnuts: has joined #ruby
[02:59:48] helpa: has joined #ruby
[03:01:50] helpa: has joined #ruby
[03:03:50] helpa: has joined #ruby
[03:05:50] helpa: has joined #ruby
[03:07:51] helpa: has joined #ruby
[03:09:23] braincrash: has joined #ruby
[03:09:52] helpa: has joined #ruby
[03:11:53] helpa: has joined #ruby
[03:13:53] helpa: has joined #ruby
[03:14:04] arkaros: has joined #ruby
[03:14:36] i8igmac: how can i read each line of a file and make this into a json array.
[03:15:38] i8igmac: {"data":['this is line of']}, {"data":['this is line 2']}, {"data":['and line 3']}
[03:15:54] helpa: has joined #ruby
[03:17:19] akosednar: has joined #ruby
[03:17:56] helpa: has joined #ruby
[03:19:55] helpa: has joined #ruby
[03:21:56] helpa: has joined #ruby
[03:23:10] Radar: i8igmac: what have you tireD?
[03:23:26] i8igmac: what im about to try is going to be ugly
[03:23:41] i8igmac: im reading docs on json right now
[03:23:57] helpa: has joined #ruby
[03:26:01] helpa: has joined #ruby
[03:28:01] helpa: has joined #ruby
[03:30:02] helpa: has joined #ruby
[03:32:02] helpa: has joined #ruby
[03:34:03] helpa: has joined #ruby
[03:34:25] tAn: has joined #ruby
[03:34:34] orbyt_: i8igmac https://gist.github.com/Orbyt/3e798b6a29a9675e430febbe273a467b should work
[03:36:05] helpa: has joined #ruby
[03:36:10] i8igmac: i was trying to use Hash.. thank you
[03:36:35] Freshnuts: has joined #ruby
[03:36:38] i8igmac: this will help me in the future
[03:36:43] i8igmac: for other things
[03:38:05] helpa: has joined #ruby
[03:40:05] helpa: has joined #ruby
[03:40:23] orbyt_: whats that?
[03:40:52] i8igmac: http://easyautocomplete.com/ a demo page
[03:41:10] i8igmac: its when your search bar can predict the words your about to type
[03:41:27] dellavg_: has joined #ruby
[03:41:30] orbyt_: oh autocomplete
[03:41:42] i8igmac: yah, lol i dont know what im talking about
[03:42:06] helpa: has joined #ruby
[03:42:13] i8igmac: im excited lol thanks for your help
[03:44:06] helpa: has joined #ruby
[03:44:33] faitswulff: has joined #ruby
[03:46:07] helpa: has joined #ruby
[03:47:22] i8igmac: ok... here we go... lol it might crash
[03:50:09] helpa: has joined #ruby
[03:52:10] helpa: has joined #ruby
[03:53:25] nofxx: has joined #ruby
[03:54:11] helpa: has joined #ruby
[03:56:11] helpa: has joined #ruby
[03:57:50] i8igmac: ill try and put it in a tmpfs or ram file system or w.e
[03:58:13] helpa: has joined #ruby
[04:00:19] helpa: has joined #ruby
[04:01:29] dinfuehr: has joined #ruby
[04:02:14] helpa: has joined #ruby
[04:04:15] helpa: has joined #ruby
[04:06:16] helpa: has joined #ruby
[04:07:45] rishispeets: has joined #ruby
[04:08:17] helpa: has joined #ruby
[04:10:18] helpa: has joined #ruby
[04:12:17] helpa: has joined #ruby
[04:14:23] helpa: has joined #ruby
[04:16:23] helpa: has joined #ruby
[04:18:23] helpa: has joined #ruby
[04:20:24] helpa: has joined #ruby
[04:21:44] faitswulff: has joined #ruby
[04:22:25] helpa: has joined #ruby
[04:23:02] akem: has joined #ruby
[04:24:26] helpa: has joined #ruby
[04:26:26] helpa: has joined #ruby
[04:28:27] helpa: has joined #ruby
[04:30:28] helpa: has joined #ruby
[04:30:36] havenwood: >> require 'abbrev'; Abbrev.abbrev %w[i8igmac i8i mac]
[04:32:30] helpa: has joined #ruby
[04:33:59] havenwood: i8igmac: If you want something faster and fancier, PostgreSQL has Trigrams. You can index them. It's great.
[04:34:05] havenwood: i8igmac: https://www.postgresql.org/docs/10/static/pgtrgm.html
[04:34:31] helpa: has joined #ruby
[04:34:35] havenwood: When you don't quite need elastic search. ;P
[04:36:32] helpa: has joined #ruby
[04:38:31] helpa: has joined #ruby
[04:40:34] helpa: has joined #ruby
[04:42:34] helpa: has joined #ruby
[04:44:36] helpa: has joined #ruby
[04:46:37] helpa: has joined #ruby
[04:48:36] helpa: has joined #ruby
[04:50:36] helpa: has joined #ruby
[04:51:34] dinfuehr: has joined #ruby
[04:56:34] dinfuehr: has joined #ruby
[05:01:49] dinfuehr: has joined #ruby
[05:06:47] rishispeets: has joined #ruby
[05:09:26] dinfuehr: has joined #ruby
[05:10:34] rishispeets: has joined #ruby
[05:13:40] dinfuehr_: has joined #ruby
[05:35:24] helpa: has joined #ruby
[05:35:55] helpa: has joined #ruby
[05:37:31] arkaros: has joined #ruby
[05:58:07] elphe: has joined #ruby
[06:02:12] venmx: has joined #ruby
[06:03:32] tAn: has joined #ruby
[06:06:07] sauvin: has joined #ruby
[06:14:02] aupadhye: has joined #ruby
[06:15:13] Sup3rLurk: has joined #ruby
[06:15:15] SuperL4g_: has joined #ruby
[06:21:31] DTZUZO: has joined #ruby
[06:22:36] faitswulff: has joined #ruby
[06:24:02] aufi_: has joined #ruby
[06:27:04] maufart__: has joined #ruby
[06:30:20] moei: has joined #ruby
[06:31:11] duderonomy: has joined #ruby
[06:35:43] aufi: has joined #ruby
[06:39:17] edwardly: has joined #ruby
[06:41:32] aufi_: has joined #ruby
[06:44:26] arkaros: has joined #ruby
[06:49:24] arkaros: has left #ruby: ()
[06:52:44] marz_d`ghostman: I have this test: http://termbin.com/tpcy but it seems to pass whether I put expect_any_instance_of(DB).to receive(:update_sync_result_status) or expect_any_instance_of(DB).not_to receive(:update_sync_result_status)
[07:03:10] duderonomy: has joined #ruby
[07:08:33] aufi: has joined #ruby
[07:11:03] baweaver: The lemurs have another destination in mind after RubyConf: https://twitter.com/keystonelemur/status/1047383112575938560
[07:11:08] Azure|dc: has joined #ruby
[07:16:55] clemens3: has joined #ruby
[07:17:28] dbz: has joined #ruby
[07:18:22] yohji: has joined #ruby
[07:24:15] dinfuehr: has joined #ruby
[07:25:10] Axsuul: has joined #ruby
[07:32:46] Eiam: has joined #ruby
[07:32:46] LiftLeft: has joined #ruby
[07:32:46] hsiktas: has joined #ruby
[07:32:46] Fridtjof: has joined #ruby
[07:32:46] S007: has joined #ruby
[07:32:46] argoneus: has joined #ruby
[07:32:46] Guest48993: has joined #ruby
[07:32:46] goez: has joined #ruby
[07:32:46] x0F: has joined #ruby
[07:32:47] ablackack: has joined #ruby
[07:32:47] bastilian: has joined #ruby
[07:37:34] Fusl: has joined #ruby
[07:38:09] hsiktas: has joined #ruby
[07:42:33] Lytol: has joined #ruby
[07:45:57] jmcgnh: has joined #ruby
[07:52:29] za1b1tsu: how can I delete from a file, starting from a known position until the end of file?
[07:58:09] evdubs_: has joined #ruby
[08:07:29] techsethi: has joined #ruby
[08:13:47] snickers: has joined #ruby
[08:16:32] aufi: has joined #ruby
[08:22:14] CustosLimen: has joined #ruby
[08:23:33] faitswulff: has joined #ruby
[08:27:15] Fusl: has joined #ruby
[08:27:17] evdubs_: has joined #ruby
[08:27:17] Eiam: has joined #ruby
[08:27:17] LiftLeft: has joined #ruby
[08:27:17] Fridtjof: has joined #ruby
[08:27:17] S007: has joined #ruby
[08:27:17] argoneus: has joined #ruby
[08:27:17] Guest48993: has joined #ruby
[08:27:17] goez: has joined #ruby
[08:27:17] x0F: has joined #ruby
[08:27:17] ablackack: has joined #ruby
[08:27:17] bastilian: has joined #ruby
[08:29:07] lxsameer: has joined #ruby
[08:32:24] za1b1tsu: File.truncate(file_name, File.size(file_name) - pos)
[08:32:33] za1b1tsu: could not find a portable solution, but looks clean
[08:37:28] c0ncealed3: has joined #ruby
[08:43:28] xfbs: has joined #ruby
[08:51:43] marz_d`ghostman: How to best design a class for database interaction?
[08:58:01] McSoFake: has joined #ruby
[09:01:45] teclator: has joined #ruby
[09:01:59] Fusl: has joined #ruby
[09:02:06] Silex: has joined #ruby
[09:05:08] evdubs_: has joined #ruby
[09:05:09] Eiam: has joined #ruby
[09:05:09] LiftLeft: has joined #ruby
[09:05:09] Fridtjof: has joined #ruby
[09:05:09] S007: has joined #ruby
[09:05:09] argoneus: has joined #ruby
[09:05:09] Guest48993: has joined #ruby
[09:05:09] goez: has joined #ruby
[09:05:09] x0F: has joined #ruby
[09:05:09] ablackack: has joined #ruby
[09:05:09] bastilian: has joined #ruby
[09:07:11] gregf_: has joined #ruby
[09:09:11] Mike11: has joined #ruby
[09:15:20] za1b1tsu: So returning a hash from a method is bad practice?
[09:17:43] hurricanehrndz: has joined #ruby
[09:18:43] canton7: more context?
[09:24:35] BloodyMary: has joined #ruby
[09:28:21] troulouliou_div2: has joined #ruby
[09:33:55] CustosLimen: has joined #ruby
[09:48:26] tdy: has joined #ruby
[09:48:34] leafyleong: has joined #ruby
[09:52:03] marz_d`ghostman: I have a module_function, how do I test it was invoked in rspec?
[09:53:37] Tempesta: has joined #ruby
[10:07:00] Juzzika: has joined #ruby
[10:25:54] NightMonkey: has joined #ruby
[10:29:36] dinfuehr: has joined #ruby
[10:49:27] schneider: has joined #ruby
[11:00:30] tdy: has joined #ruby
[11:13:08] rspades: has joined #ruby
[11:20:04] dbz: has joined #ruby
[11:22:13] d^sh: has joined #ruby
[11:23:30] TomyLobo: has joined #ruby
[11:33:36] Nicmavr: has joined #ruby
[11:43:28] wojnar: has joined #ruby
[11:45:48] faitswulff: has joined #ruby
[12:02:54] VladGh: has joined #ruby
[12:07:20] mzo: has joined #ruby
[12:07:30] rspades_: has joined #ruby
[12:14:13] AJA4350: has joined #ruby
[12:19:53] [spoiler]: has joined #ruby
[12:21:32] [spoiler]: has joined #ruby
[12:29:14] DTZUZO: has joined #ruby
[12:34:15] bmurt: has joined #ruby
[12:35:11] faitswulff: has joined #ruby
[12:46:10] nowhere_man: has joined #ruby
[12:53:31] z64: marz_d`ghostman: the receiver of methods defined with module_function is the class; `expect(MyClass).to receive(foo)` would expect that `MyClass.foo` is called
[12:53:49] z64: *`receive(:foo)`
[12:54:43] za1b1tsu: How would you name a module that contains methods for file manipulation?
[13:03:05] bkxd: has joined #ruby
[13:07:27] dmitch: has joined #ruby
[13:19:37] nickjj: has joined #ruby
[13:26:02] tdy: has joined #ruby
[13:32:10] sheepman: has joined #ruby
[13:32:51] rwb: has joined #ruby
[13:50:53] faitswulff: has joined #ruby
[13:52:52] chouhoulis: has joined #ruby
[13:58:46] vondruch: has joined #ruby
[14:01:15] Rapture: has joined #ruby
[14:03:05] pskosinski_: has joined #ruby
[14:03:37] apparition: has joined #ruby
[14:03:40] hays_: has joined #ruby
[14:04:29] jtdowney: has joined #ruby
[14:06:00] zenspider: has joined #ruby
[14:06:40] Scient: has joined #ruby
[14:07:46] gsingh93: has joined #ruby
[14:13:27] faitswulff: has joined #ruby
[14:16:10] krawchyk: has joined #ruby
[14:43:08] nowhere_man: has joined #ruby
[14:43:44] rspades_: has joined #ruby
[14:49:29] AllenTristan: has joined #ruby
[14:51:15] conta1: has joined #ruby
[14:54:02] AllenTristan: has left #ruby: ()
[14:57:21] snickers: has joined #ruby
[15:03:10] openstruct: has joined #ruby
[15:08:01] troys: has joined #ruby
[15:40:36] orbyt_: has joined #ruby
[15:42:02] cd: has joined #ruby
[15:56:05] tdy: has joined #ruby
[16:04:00] faitswulff: has joined #ruby
[16:06:57] [spoiler]: has joined #ruby
[16:07:42] [spoiler]: has joined #ruby
[16:15:29] akem: has joined #ruby
[16:15:40] TheNet: what's an elegant way to handle boolean env vars in a rails config?
[16:17:27] sonne: i usually consider any nonempty value as true
[16:18:36] sonne: the only boolean thing about env vars is being set or not being set, so i adopt that - not necessarily the best thing to do though
[16:18:36] nofxx1: has joined #ruby
[16:22:58] TheNet: sonne: I don't think FOO=false is that uncommon
[16:28:16] ivanskie: has joined #ruby
[16:29:48] TheNet: my rails is slow due to stdout backpressure—if I reduce logging or hide my rails terminal pane I get a significant performance boost. anyone have any details on this?
[16:30:09] rippa: has joined #ruby
[16:31:09] desperek: has joined #ruby
[16:36:08] elphe: has joined #ruby
[16:36:23] havenwood: TheNet: ActiveModel::Type::Boolean.new.cast ENV.fetch 'FOO', false
[16:37:14] TheNet: havenwood: interesting
[16:37:41] darkhanb: has joined #ruby
[16:39:43] code_zombie: has joined #ruby
[16:47:21] wojnar: has joined #ruby
[16:57:20] TheNet: hmm, can I increase the stdout buffer
[17:07:28] tdy: has joined #ruby
[17:08:01] akem: has joined #ruby
[17:09:10] dbz: has joined #ruby
[17:13:02] akem: has joined #ruby
[17:15:48] doubledup: has joined #ruby
[17:36:55] dviola: has joined #ruby
[17:37:27] TACTICALNEURALIM: has joined #ruby
[17:37:42] TACTICALNEURALIM: how do I get a controller to render existing json?
[17:38:03] Mike11: has joined #ruby
[17:38:07] TACTICALNEURALIM: render :json foo tries to JSONify foo. Foo is already JSON. I cannot remember how this is done and my searches keep finding irrelevant stuff
[17:38:26] nowhere_man: has joined #ruby
[17:38:40] TACTICALNEURALIM: oops wrong channel. My mistake
[17:39:03] nofxx1: has joined #ruby
[17:41:25] sameerynho: has joined #ruby
[17:42:53] nofxx: has joined #ruby
[17:43:36] dreamthese: has joined #ruby
[17:47:40] dviola: has joined #ruby
[17:50:54] nofxx: has joined #ruby
[17:53:03] fluxAeon: has joined #ruby
[17:56:53] Puffball: has joined #ruby
[17:57:48] fredlinhares: has joined #ruby
[17:59:14] SeepingN: has joined #ruby
[18:02:27] dbz_: has joined #ruby
[18:09:44] ivanskie: has joined #ruby
[18:13:13] dellavg_: has joined #ruby
[18:15:45] dbz: has joined #ruby
[18:17:19] dbz_: has joined #ruby
[18:22:15] RougeR: has joined #ruby
[18:24:20] elphe: has joined #ruby
[18:31:07] weaksauce: has joined #ruby
[18:33:23] sgen: has joined #ruby
[18:35:08] postmodern: has joined #ruby
[18:40:24] agent_white: has joined #ruby
[18:59:00] cliluw: has joined #ruby
[18:59:34] za1b1tsu: has joined #ruby
[19:05:09] chouhoulis: has joined #ruby
[19:10:46] cthu|: I had this issue yesterday
[19:10:54] cthu|: when I can't open a file for reading
[19:11:02] cthu|: and Ruby says the file doesn't exist
[19:11:22] cthu|: although if I do byebug right before I open it for reading and check if it exists, it does
[19:11:33] cthu|: I use the exact same path expression to check and to open
[19:11:36] cthu|: very weird
[19:11:43] cthu|: how do I debug this further?
[19:14:18] nofxx1: has joined #ruby
[19:16:24] dbz: has joined #ruby
[19:17:35] duderonomy: has joined #ruby
[19:19:39] cthu|: I think I found it
[19:19:52] cthu|: File.open uses relative path
[19:20:24] sgen: has joined #ruby
[19:21:05] cthu|: File.exist? File.expand_path "" uses absolute
[19:21:36] cthu|: hell, Ruby, why are you not smart enough to understand whether the path is relative or absolute on your own?
[19:21:50] cthu|: Hint: if it starts from / or ~, it's absolute
[19:23:04] cthu|: oh, no, it's different
[19:23:09] cthu|: Ruby doesn't expand path
[19:23:14] cthu|: that's what I'm having
[19:23:20] cthu|: I need to ask it to do so explicitly
[19:23:33] pulgolino: has joined #ruby
[19:23:37] cthu|: see? I also can help someone on this channel
[19:26:06] nofxx: has joined #ruby
[19:27:41] nofxx1: has joined #ruby
[19:33:22] sgen: has joined #ruby
[19:44:06] leafyleong: has joined #ruby
[19:46:35] cthu|: yes, that was the reason
[19:47:43] ruurd: has joined #ruby
[19:49:47] Xiti: has joined #ruby
[19:50:41] zenspider: glad you had this conversation...
[19:50:55] nowhere_man: has joined #ruby
[19:51:44] cthu|: always yours
[19:52:09] cthu|: spreading wisdom
[19:52:18] zenspider: I'm not so sure about that part...
[19:52:32] cthu|: sure you're not
[19:52:41] cthu|: how would you know
[19:52:55] cthu|: no, the world for you has to seem too stupid
[19:53:03] zenspider: to clarify, File.open and File.exist? use whatever you give them, whether that's releative or absolute, they don't care. File.expand_path, by definition, results with an absolute path. So, you need to either use it on both or neither to have an apples-to-apples comparison
[19:53:03] baweaver_away: likely not something you want to... Na, nevermind.
[19:53:30] zenspider: don't push it...
[19:54:05] cthu|: so it is smart enough to parse the path and know whether it's absolute or relative?]
[19:54:18] zenspider: nope. it just uses whatever string you hand it
[19:54:36] cthu|: and it uses it as what?
[19:54:45] cthu|: as relative path, I believe
[19:54:46] baweaver: Does it start with a / ?
[19:54:49] cthu|: just like require does
[19:54:58] cthu|: which is why we have require_relative
[19:55:33] cthu|: so require is not smart enough to know whether the path is absolute or relative
[19:55:38] zenspider: File.open opens a path
[19:55:42] zenspider: it doesn't parse anything
[19:56:07] cthu|: as local path
[19:56:26] cthu|: you really don't make any sense
[19:56:38] baweaver: cthu| Does it start with a slash?
[19:56:54] baweaver: Yes: Absolute path. No: Relative path
[19:56:55] cthu|: baweaver, it doesn't
[19:56:57] zenspider: baweaver: doesn't matter. File.open and File.exist? don't parse anything
[19:57:04] zenspider: they just make system calls to do the thing
[19:57:10] cthu|: baweaver, thanks
[19:57:15] cthu|: that's what I thought
[19:57:15] zenspider: path is a path
[19:57:23] cthu|: consistent with require
[19:57:24] SeepingN: you do have a "current working directory" and you can change it
[19:57:36] zenspider: and it is NOT consistent with require...
[19:57:37] cthu|: what does it change?
[19:57:47] SeepingN: your current working directory. lol
[19:57:56] SeepingN: where relative things are telative to
[19:58:04] SeepingN: just like the command line
[19:58:10] cthu|: but that is not the question
[19:58:19] cthu|: the question is whether the argument is relative or absolute
[19:58:21] SeepingN: but it is fundumental to understanding wtf is going on
[19:58:34] SeepingN: it is absolute if the string starts with a /
[19:58:40] cthu|: ok, I know that
[19:58:45] SeepingN: so there you go
[19:58:46] zenspider: and the answer is and has been: it doesn't matter. it's a path
[19:58:59] cthu|: no, you didn't get the question
[19:59:04] zenspider: I get it just fine
[19:59:18] cthu|: the question is whether the function expects the relative or the absolute path
[19:59:21] zenspider: you don't get the ramifications of what I'm saying
[19:59:29] zenspider: I've answered that. three times
[19:59:31] SeepingN: if the path is "somefolder/somesubfolder/x" the aboslute path is $cwd/somefolder/somesubfolder/x
[19:59:41] zenspider: you're inability to listen to my answer is beside the point
[19:59:44] cthu|: SeepingN, it's not the answer
[19:59:58] cthu|: SeepingN, oh
[20:00:07] cthu|: so it's smart enough to parse it
[20:00:24] cthu|: and use different behavior depending on whether there is a / or no
[20:00:33] zenspider: no no and no
[20:00:54] cthu|: zenspider, feel free to quit repeating same stuff over and over. it's not helpful
[20:01:08] cthu|: SeepingN, why no?
[20:01:23] zenspider: I could say the same to you. My inability to distinguish you from a basic troll right now isn't helping your case to get help
[20:01:37] SeepingN: if it doesn't start with / or ~, prepend your current path to get "the absolute path". that may or may nto lead to a valid file or directory depending on where you are. So ok sure, it's smart enough to do that.
[20:01:43] cthu|: zenspider, just ignore me. you don't seem to be able to help.
[20:02:01] baweaver: Uncalled for.
[20:02:06] cthu|: very called
[20:02:14] zenspider: !kick cthu|
[20:02:26] cthu|: like I'm a problem here, right?
[20:02:29] baweaver: ACTION checks watch
[20:02:36] baweaver: ACTION stares at bot
[20:02:50] cthu|: SeepingN, thank you
[20:02:56] cthu|: that's what I wanted to find out
[20:03:03] cthu|: zenspider, you actually were misleading
[20:03:29] baweaver: !kick cthu|
[20:03:31] zenspider: nope. I actually wasn't.
[20:03:38] SeepingN: you need to read up on the File dox
[20:03:46] baweaver: Hrm, doesn't like me either for the moment
[20:03:48] cthu|: yeah, I will, thanks
[20:04:20] SeepingN: http://ruby-doc.org/core-2.5.1/Dir.html#method-c-pwd
[20:05:20] cthu|: I still don't get why require doesn't have the same approach
[20:06:00] cthu|: if I do require("../../lib/whatever"), it gives me an error
[20:06:00] SeepingN: require can work on files
[20:06:18] SeepingN: check our Dir.pwd first
[20:06:23] zenspider: read up on require
[20:06:24] SeepingN: I don't think that's related
[20:06:24] cthu|: so there's require_relative to use the dir.pwd, effectively
[20:06:25] zenspider: it's very clear
[20:06:36] baweaver: https://github.com/ericmathison/articles/blob/master/understaning-require-in-ruby.md
[20:07:00] sgen_: has joined #ruby
[20:07:03] cthu|: SeepingN, I'm aware about working directory
[20:07:16] zenspider: well... it was... looks like rubygems rewrote it?
[20:07:41] zenspider: if you do a relative path for require, you need to supply the extension as well
[20:07:53] SeepingN: oops. $LOAD_PATH is where it looks when you don't give it a file path and just a 'name'
[20:08:07] cthu|: I ended up not using require at all
[20:08:16] cthu|: I use require_relative all the time.
[20:08:29] cthu|: I honestly don't understand why it's not flipped
[20:08:37] cthu|: it should be require and require_absolute
[20:08:45] SeepingN: may be best if you're tinkering and don't have a "real official server environemnt" set up / defined
[20:08:53] cthu|: in what world would you want explicitly absolute require. It's a bit weird
[20:09:18] cthu|: SeepingN, but that's very beginning
[20:09:21] johnny56: has joined #ruby
[20:09:22] SeepingN: I suspect most requires dont have paths at all
[20:09:30] cthu|: oh, right
[20:09:34] cthu|: cuz they require from gems
[20:10:20] cthu|: I think require is just a question of legacy
[20:10:28] cthu|: or maybe it's fixed in newer versions
[20:10:31] cthu|: I'm on 2.2 still
[20:11:25] havenwood: cthu|: On modern Ruby, "." isn't in $LOAD_PATH.
[20:11:57] zenspider: heh. where "modern" is the last... what... 10+ years?
[20:12:23] havenwood: ACTION tries to remember back as far as 1.8
[20:12:33] zenspider: 1.8 had "."... 1.9 did not iirc
[20:12:42] elphe: has joined #ruby
[20:12:43] havenwood: Yeah, that's my recollection as well.
[20:12:47] zenspider: broke some of my stuff. 1.9 was a disaster in so many ways
[20:13:01] za1b1tsu: what do you folks recommend for a light object return object: BasicObject, Hash, OpenStruct, or custom Object with just some attributes?
[20:13:06] zenspider: tho I wish they'd still do the shim thing for upcoming versions
[20:13:16] SeepingN: we went from 1.8.6 to 1.8.7 and even that was a nightmare for my handful of scripts
[20:13:20] havenwood: za1b1tsu: Struct
[20:13:38] havenwood: za1b1tsu: But really, say more about what you're doing.
[20:13:49] cthu|: what . are you talking about?
[20:14:18] SeepingN: . = current directory
[20:14:23] cthu|: oh, right
[20:14:25] zenspider: za1b1tsu: what are your goals?
[20:14:26] havenwood: cthu|: In your REPL, take a look at: $LOAD_PATH
[20:14:48] za1b1tsu: havenwood: I sending data from a function to a function, I would like to use good practices. I am using yard for documentation and I was having problem with docuemnting @return Hash. After some reading it seems returning Hashes is not a good practice.
[20:15:14] zenspider: za1b1tsu: use real / ordinary objects wherever possible.
[20:15:36] zenspider: I wouldn't recommend struct for normal use. They have too many gotchas
[20:15:51] zenspider: I use struct for quick prototyping... and avoid it otherwise
[20:15:59] sgen_: has joined #ruby
[20:16:00] havenwood: cthu|: You'll see there's not a "." by default in $LOAD_PATH in Ruby 1.9+.
[20:16:10] havenwood: cthu|: So "." isn't one of the places #require is checking.
[20:16:25] za1b1tsu: zenspider: what about a BasicObject with just some attributes implementations?
[20:16:39] zenspider: za1b1tsu: to what end? what are you trying to avoid?
[20:18:25] zenspider: it doesn't matter if your object subclasses BasicObject or Object. They'll hold onto whatever you make them hold onto. That's not bloat, that's need. If you don't make them hold onto superfluous stuff, and nothing extra holds onto them (like closures), they'll be fine
[20:18:44] havenwood: cthu|: Here's an example of how you might reimplement #require_relative yourself: https://gist.github.com/havenwood/930fa089aaeb0cb2277eb90aef60e431
[20:18:48] zenspider: stick to the simplest thing that could possibly work, until you have evidence/measurements that say you should do otherwise
[20:19:09] havenwood: cthu|: Note, I'm using `__dir__` not `Dir.pwd`.
[20:19:13] za1b1tsu: good advice zenspider, cheers
[20:19:46] zenspider: za1b1tsu: one way to look is to try something like this: /usr/bin/time -l ruby -e 't0 = Time.now; 10_000_000.times do BasicObject.new end; p Time.now - t0'
[20:20:22] zenspider: on my laptop, on battery, I take just about 1 second to produce 10m objects whether it is BasicObject or Object. The maximum resident set size doesn't change either.
[20:20:55] SeepingN: havenwood: nice
[20:21:10] roshanavand: has joined #ruby
[20:21:31] za1b1tsu: zenspider: wow, Hashes are way slower then Object
[20:22:02] za1b1tsu: when I do class Something. It inherits from Object correct? So it should be faster then Hashes
[20:22:17] zenspider: hash literals need to be copied on every instantiation, but they shouldn't be that slow
[20:23:04] zenspider: doing the above cmdline replacing Object.new with {} results in it being 60% faster
[20:23:27] zenspider: but adding stuff to the hash? makes it not an apples-to-apples comparison. It slows down to ~3.7 seconds on my side
[20:23:57] za1b1tsu: ahh I was using Hash.new
[20:24:05] havenwood: za1b1tsu: BasicObject is a bit too basic for most use. I'd start thinking from Object.
[20:24:57] zenspider: za1b1tsu: Hash.new is a const lookup + method call... takes 4.19 seconds on my side. {} is a static hash in the bytecode + dup
[20:25:02] havenwood: za1b1tsu: Structs are a nice way to prototype, and they keep arbitrary keys from getting in the mix.
[20:25:19] zenspider: Hash.new will be closer to reality as you'll make some class of your own and instantiate on it
[20:26:03] zenspider: havenwood: and have nasty gotchas like to_a
[20:26:16] zenspider: really really really dislike that. it's bit me on many occasions
[20:26:46] zenspider: I want a superclass BasicStruct that is pretty much just initialize + attr_accessor
[20:26:54] zenspider: I'd use the fuck out of that
[20:27:39] za1b1tsu: can't that be made from BasicObject?
[20:27:55] zenspider: it can... but it won't have the C speeds I want :P
[20:28:13] zenspider: well... and no. I don't want it off of BasicObject... that's TOO basic
[20:28:29] zenspider: BasicObject is for when you want something that's not really object-like... usually proxy objects and the like
[20:29:14] dviola: has joined #ruby
[20:32:21] clemens3: has joined #ruby
[20:34:52] tAn: has joined #ruby
[20:42:44] DTZUZO: has joined #ruby
[20:51:44] Eiam: zenspider: OpenStruct?
[20:52:23] zenspider: Eiam: oooonly for rapid prototyping. And I will use Struct 99% of the time for that. OpenStruct is overly magical
[20:53:42] Eiam: rubyist generally love magic tho
[20:53:52] Eiam: ACTION tosses out rainbows
[21:01:20] rwb: has joined #ruby
[21:01:50] tdy: has joined #ruby
[21:06:05] tag: has joined #ruby
[21:10:27] tAn: has joined #ruby
[21:12:43] zenspider: Eiam: Some certainly do. And in general, their code is bloated and slow.
[21:17:03] chouhoulis: has joined #ruby
[21:36:09] bousquet: has joined #ruby
[22:00:56] elphe: has joined #ruby
[22:07:41] AKPWD: has joined #ruby
[22:09:51] Dark_Arc: has joined #ruby
[22:11:06] Exagone313: has joined #ruby
[22:19:04] nowhere_man: has joined #ruby
[22:20:42] riotjones: has joined #ruby
[22:24:38] vondruch_: has joined #ruby
[22:29:55] elphe: has joined #ruby
[22:31:22] agent_white: has joined #ruby
[22:31:34] akem: has joined #ruby
[22:34:14] ramfjord: has joined #ruby
[22:36:42] cthu|: knowing is soo much better than not knowing
[22:39:38] troulouliou_dev: has joined #ruby
[22:39:45] tdy: has joined #ruby
[22:42:26] themsay: has joined #ruby
[22:54:57] Eiam: perfs not a problem until its a problem!
[22:56:20] mzo: has joined #ruby
[23:06:20] cthu|: genymotion creates app logs dynamically
[23:06:31] cthu|: appending a process id to the file name
[23:07:07] cthu|: now I have to look for all files that have "logcat" in the name and then find the heaviest one
[23:07:13] cthu|: ridiculous
[23:13:02] Radar: Computers are at it again.
[23:14:04] dogweather_: has joined #ruby
[23:14:13] DTZUZO: has joined #ruby
[23:16:38] dogweather: has joined #ruby
[23:30:22] lxsameer: has joined #ruby
[23:31:07] dogweather: has joined #ruby
[23:33:56] themsay: has joined #ruby
[23:35:06] DTZUZO: has joined #ruby
[23:37:09] cschneid_: has joined #ruby
[23:37:25] DTZUZO_: has joined #ruby
[23:41:19] themsay: has joined #ruby
[23:50:22] DTZUZO_: has joined #ruby
[23:57:23] themsay: has joined #ruby