« Back to channel list

#ruby - 19 May 2019

« Back 1 day Forward 1 day »
[00:10:28] nowhereman: has joined #ruby
[00:10:36] skryking: has joined #ruby
[00:30:08] Mia: has joined #ruby
[00:30:08] Mia: has joined #ruby
[00:33:44] Mia: has joined #ruby
[00:33:44] Mia: has joined #ruby
[00:33:52] Nosrep: has joined #ruby
[00:34:24] Nosrep: has left #ruby: ()
[01:04:37] brool: has joined #ruby
[01:06:53] duderonomy: has joined #ruby
[01:09:39] carbone5: has joined #ruby
[01:39:38] carbone5: Hello! What fo type of software do you use to save your code snippets to reuse in other projects ?
[01:46:17] Tempesta: has joined #ruby
[01:49:51] orbyt_: has joined #ruby
[02:02:39] carbone5: has joined #ruby
[02:04:05] KrzaQ: I'm using the sequel gem and I have a bit of a problem: I want to create a table from a schema of another table I'd dumped, but I don't see a way to do this programmatically. Is rewriting the create_table methods manually the only option?
[02:14:44] tdy: has joined #ruby
[02:14:58] dsmythe: has joined #ruby
[02:16:08] Fusl: has joined #ruby
[02:20:36] orbyt_: has joined #ruby
[02:27:12] _whitelogger: has joined #ruby
[02:55:22] carbone5: has joined #ruby
[03:01:17] carbone5: has joined #ruby
[03:09:52] braincrash: has joined #ruby
[03:10:21] dsmythe_: has joined #ruby
[03:11:37] Nicmavr: has joined #ruby
[03:12:06] jenrzzz: has joined #ruby
[03:27:11] _whitelogger: has joined #ruby
[03:37:26] teclator: has joined #ruby
[03:37:32] teclator_: has joined #ruby
[03:37:46] zacstewart: has joined #ruby
[03:41:23] Swyper: has joined #ruby
[03:44:23] Swyper: has joined #ruby
[03:44:51] cd: has joined #ruby
[03:48:16] bambanx: has joined #ruby
[03:52:07] apparition: has joined #ruby
[04:12:10] _whitelogger: has joined #ruby
[04:20:10] jettrevolver: carbone5: leptop or i open a folder in my ide's sidebar with files including snipperz XD
[04:36:19] ricekrispie: has joined #ruby
[04:40:49] laaron: has joined #ruby
[04:46:30] dsmythe: has joined #ruby
[04:56:43] Kestrel-029: has joined #ruby
[05:20:54] Swyper: has joined #ruby
[05:27:07] bjpenn: has joined #ruby
[05:32:00] dsmythe: has joined #ruby
[05:32:06] kapilp: has joined #ruby
[05:53:58] banisterfiend: has joined #ruby
[06:14:38] kyrylo: has joined #ruby
[06:21:38] dsmythe: has joined #ruby
[06:25:36] dsmythe_: has joined #ruby
[06:27:17] apparition: has joined #ruby
[06:34:47] bjpenn: has joined #ruby
[06:57:27] leimh: has joined #ruby
[06:59:05] sameerynho: has joined #ruby
[07:20:39] nowhereman: has joined #ruby
[07:24:47] ravenousmoose: has joined #ruby
[07:39:26] DTZUZO: has joined #ruby
[07:42:21] reber: has joined #ruby
[07:45:31] reber__: has joined #ruby
[07:46:51] Ai9zO5AP: has joined #ruby
[07:47:36] kyrylo: has joined #ruby
[08:02:35] kyrylo: has joined #ruby
[08:10:08] ricekrispie2: has joined #ruby
[08:13:10] dsmythe: has joined #ruby
[08:15:20] esp32_prog: has joined #ruby
[08:18:58] kapilp: has joined #ruby
[08:21:45] rafadc: has joined #ruby
[08:22:15] Dbugger: has joined #ruby
[08:35:44] dellavg_: has joined #ruby
[08:36:41] al2o3-cr: has joined #ruby
[08:47:07] conta: has joined #ruby
[09:01:12] fphilipe: has joined #ruby
[09:09:03] priodev: has joined #ruby
[09:10:00] yqt: has joined #ruby
[09:16:11] al2o3-cr: has joined #ruby
[09:32:23] doodlebug: has joined #ruby
[09:39:31] gix: has joined #ruby
[09:45:20] al2o3-cr: has joined #ruby
[09:45:37] ellcs: has joined #ruby
[10:13:39] tdy: has joined #ruby
[10:22:38] AJA4350: has joined #ruby
[10:22:45] bjpenn: has joined #ruby
[10:25:06] bjpenn: has joined #ruby
[10:53:11] dviola: has joined #ruby
[11:12:57] DTZUZO: has joined #ruby
[11:25:32] fphilipe: has joined #ruby
[11:28:06] dar123: has joined #ruby
[11:29:01] tf2ftw: has joined #ruby
[11:39:42] IGnorAND: When assigning an int we use _ to make the integer readable. If I have money in cents, would it make sense to write 10K as 10_000_00 or do I need to write it as 1_000_000?
[11:42:11] ytti: 10_000_00 seems outright passive aggressive
[11:42:21] lupine: you can put them anywhere you want, syntactically
[11:42:32] lupine: 1_0_00_000 perhaps
[11:42:49] ytti: three zeroes or i'll call HR
[11:43:17] ytti: also be sure you have appropriate class to deal with money
[11:43:32] ytti: money is special and using native types is not the right solution
[11:45:09] esp32_prog: has joined #ruby
[11:45:28] lupine: particularly, consider fractional cents
[11:45:43] lupine: as superman proved, you will have to handle them from time to time
[11:53:34] xco: has joined #ruby
[12:01:51] Fusl: has joined #ruby
[12:15:37] hiroaki: has joined #ruby
[12:18:40] Ai9zO5AP: has joined #ruby
[12:19:56] queip: has joined #ruby
[12:20:38] Ai9zO5AP: has joined #ruby
[12:27:00] Ai9zO5AP: has joined #ruby
[12:29:17] hays: has joined #ruby
[12:29:35] Swyper: has joined #ruby
[12:38:59] sagax: has joined #ruby
[12:41:21] al2o3-cr: has joined #ruby
[12:43:06] obzidian: has joined #ruby
[12:46:56] Swyper: has joined #ruby
[12:51:42] laaron: has joined #ruby
[12:52:21] obzidian: has left #ruby: ()
[12:53:25] AJA4350: has joined #ruby
[12:54:18] queip: has joined #ruby
[12:57:36] sonivi: has joined #ruby
[12:58:08] weird_error: has joined #ruby
[12:58:45] sonivi: was trying to fetch data from site https://mphc.gov.in/causelist
[12:59:10] sonivi: using mechanise gem.. but could understand how to get and set the cookie
[13:00:45] sonivi: please suggest
[13:05:09] esp32_prog: has joined #ruby
[13:11:49] havenwood: sonivi: What have you tried so far? Show the code?
[13:17:33] laaron: has joined #ruby
[13:21:11] _whitelogger: has joined #ruby
[13:26:24] fphilipe: has joined #ruby
[13:26:36] Nicmavr: has joined #ruby
[13:30:27] Kestrel-029: has joined #ruby
[13:32:25] Fernando-Basso: has joined #ruby
[13:45:45] zacts: has joined #ruby
[13:46:25] zacts: has joined #ruby
[13:48:00] sonivi: @havenwood: i tried code https://dpaste.de/qysO
[13:50:05] sonivi: havenwood: i have hard-coded the cookie
[13:56:32] tasdinq: has joined #ruby
[13:58:13] loveyouthreethou: has joined #ruby
[13:58:54] loveyouthreethou: hey quick question, if I have a class that has attr_accessor :something, how can I use that variable in to_s?
[13:59:54] phaul: loveyouthreethou: self.something
[14:00:36] phaul: it's a method techniqually not a variable.
[14:01:04] shansen: has joined #ruby
[14:01:06] loveyouthreethou: !!!! ok, so if I just need variables to hold stuff, should I probably just use a struct?
[14:02:47] phaul: struct is the same, it's methods there too. just pair of a setter + getter
[14:03:35] phaul: it's no issue, but the implicit self invocation can mislead the parser to take the token as local variable
[14:03:48] phaul: but with explicit self it's always a method call
[14:05:56] havenwood: sonivi: Here's your curl code translated to Net::HTTP: https://gist.github.com/havenwood/1d1ed51408b6fd8aa0048a21a8728fd5
[14:06:27] havenwood: sonivi: This tool will get you pretty close: https://jhawthorn.github.io/curl-to-ruby/
[14:06:28] loveyouthreethou: okay, I think I understand. I am telling ruby that in self.something, it definitely comes from my class and not local to the scope that it's currently in.
[14:07:22] phaul: yes loveyouthreethou
[14:09:52] loveyouthreethou: wonderful. thanks for your help!
[14:11:25] sonivi: havenwood: thanks this tool https://jhawthorn.github.io/curl-to-ruby/ is really nice
[14:11:41] Nicmavr: has joined #ruby
[14:12:12] sonivi: havenwood: is there any way to get this dynamically (i.e. at the time of script execution) and not the hard-code one
[14:15:00] havenwood: sonivi: You could convert that tool's logic to Ruby: https://github.com/jhawthorn/curl-to-ruby/blob/gh-pages/src/curlToRuby.js
[14:15:15] havenwood: sonivi: You have actual curl commands as input or something? :O
[14:15:27] Kestrel-029: has joined #ruby
[14:15:59] dsmythe: has joined #ruby
[14:23:16] weird_error: has joined #ruby
[14:24:20] kyrylo: has joined #ruby
[14:26:15] sonivi: havenwood: actually i was trying to fetch the data from that url
[14:26:38] sonivi: as a input i only have url
[14:27:20] sonivi: without that cookie i cannot get the data from that url
[14:27:37] zacts: has joined #ruby
[14:27:41] sonivi: unable to find a way to get and set the cookie
[14:33:27] rippa: has joined #ruby
[14:36:53] conta: has joined #ruby
[14:38:52] tf2ftw: has joined #ruby
[14:41:41] Nicmavr: has joined #ruby
[14:56:47] tdy: has joined #ruby
[15:11:47] tf2ftw2: has joined #ruby
[15:15:09] rafadc: has joined #ruby
[15:27:17] fphilipe: has joined #ruby
[15:33:52] weird_error: has joined #ruby
[15:40:33] laaron: has joined #ruby
[15:49:11] JoeA2552: has joined #ruby
[15:57:10] nowhereman: has joined #ruby
[16:02:53] agent_white: has joined #ruby
[16:25:38] GodFather_: has joined #ruby
[16:26:22] GodFather: has joined #ruby
[16:35:24] carbone5: has joined #ruby
[16:38:51] weird_error: has joined #ruby
[16:42:19] Swyper: has joined #ruby
[16:42:34] s2013: has joined #ruby
[16:45:05] s2013: https://paste.ubuntu.com/p/5m6mgjt2hh/ i am getting an error "gems/json-2.1.0/lib/json/common.rb:156:in `parse': 765: unexpected token at '' (JSON::ParserError)"
[16:45:10] s2013: not sure what im doing wrong
[16:47:52] Swyper: has joined #ruby
[16:50:08] Fischmiep: has joined #ruby
[16:57:11] Swyper: has joined #ruby
[17:01:36] Fischmiep: has joined #ruby
[17:02:18] jhass: uhm, can you show the full backtrace? your code doesn't seem to parse any json
[17:07:14] Fischmiep: has joined #ruby
[17:08:41] Nahra: has joined #ruby
[17:13:32] IGnorAND: How do I write a method to accept 2 parameters although I will only use 1 parameter in that method
[17:15:05] ravenousmoose: has joined #ruby
[17:16:26] clemens3: has joined #ruby
[17:17:36] jhass: def foo(a, b); do_stuff_with_a_only; end
[17:24:23] Fischmiep: has joined #ruby
[17:25:12] orbyt_: has joined #ruby
[17:25:58] GodFather__: has joined #ruby
[17:28:09] fphilipe: has joined #ruby
[17:28:20] Swyper: has joined #ruby
[17:28:39] GodFather: has joined #ruby
[17:29:05] dviola: has joined #ruby
[17:31:31] Swyper: has joined #ruby
[17:45:47] _serenity: has joined #ruby
[17:46:44] jgpawletko: has joined #ruby
[17:52:12] jettrevolver: IGnorAND: like leaving a default value in case you don't specify the parameter?
[18:11:41] Nicmavr: has joined #ruby
[18:18:16] IGnorAND: jettrevolver: nah, I get a warning from rubocopy that I'm not using the parameter eventhough I ask for it
[18:18:38] havenwood: IGnorAND: Use an underscore as a placeholder.
[18:18:41] IGnorAND: jhass: yeah, but rubocop doesn't like that :)
[18:18:48] havenwood: IGnorAND: def foo(bar, _)
[18:18:58] IGnorAND: havenwood: I use a hash
[18:19:06] havenwood: IGnorAND: Huh?
[18:19:11] IGnorAND: def self.cap(taxable: 0, payment_frequency: 12)
[18:19:26] IGnorAND: in one object I use taxable to calculate something
[18:19:34] IGnorAND: in the other I use payment_frequency
[18:19:46] IGnorAND: they should be ducktypes of each other
[18:20:29] havenwood: IGnorAND: Those are keyword arguments.
[18:20:50] IGnorAND: TaxDisk1.cap(a: 'value' b: 'value2') { do something with a} TaxDisk2.cap(a: 'value' b: 'value2') { do something with b}
[18:20:56] tf2ftw: has joined #ruby
[18:22:19] Swyper: has joined #ruby
[18:23:08] havenwood: IGnorAND: It's a common pattern to set a default value to `nil`.
[18:23:24] havenwood: IGnorAND: You could see which are set. Are they ever both set? Neither set?
[18:27:42] jcalla: has joined #ruby
[18:27:54] ravenousmoose: has joined #ruby
[18:29:30] IGnorAND: havenwood: https://pastebin.com/WAU7Dvnp
[18:29:30] ruby[bot]: IGnorAND: as I told you already, please use https://gist.github.com
[18:39:12] iNs: has joined #ruby
[19:06:20] Swyper: has joined #ruby
[19:10:34] Inline: has joined #ruby
[19:15:34] dar123: has joined #ruby
[19:16:50] catbusters: has joined #ruby
[19:21:37] Swyper: has joined #ruby
[19:22:48] fredmorcos: has joined #ruby
[19:24:45] d^sh: has joined #ruby
[19:29:01] fphilipe: has joined #ruby
[19:42:14] Swyper: has joined #ruby
[19:51:33] bikes: has joined #ruby
[19:53:53] Swyper: has joined #ruby
[20:04:51] Swyper: has joined #ruby
[20:07:25] Swyper: has joined #ruby
[20:09:55] orbyt_: has joined #ruby
[20:10:09] Swyper: has joined #ruby
[20:11:41] Nicmavr: has joined #ruby
[20:22:20] Shikichiro: has joined #ruby
[20:23:35] dsmythe: has joined #ruby
[20:24:42] D9: has joined #ruby
[20:33:52] elcontrastador: has joined #ruby
[20:38:08] Swyper: has joined #ruby
[20:39:49] i9zO5AP: has joined #ruby
[20:44:44] violentE: has joined #ruby
[20:45:54] s2013: has joined #ruby
[20:46:19] nevada1: has joined #ruby
[20:46:51] nevada1: How can you convert a number into a byte array?
[20:51:13] Ai9zO5AP: has joined #ruby
[20:54:55] lupine: nevada1: consider Array#pack
[20:55:59] Swyper: has joined #ruby
[21:07:02] bjpenn: has joined #ruby
[21:08:49] wald0: has joined #ruby
[21:12:34] weird_error: has joined #ruby
[21:12:56] SCHAPiE: has joined #ruby
[21:14:07] m_antis: has joined #ruby
[21:14:52] ellcs: has joined #ruby
[21:15:40] ellcs: has joined #ruby
[21:16:36] ellcs: has joined #ruby
[21:17:35] ellcs: has joined #ruby
[21:17:57] m_antis_: has joined #ruby
[21:18:12] ellcs: has joined #ruby
[21:18:47] ellcs: has joined #ruby
[21:21:06] darix: has joined #ruby
[21:26:26] fphilipe: has joined #ruby
[21:27:38] tdy: has joined #ruby
[21:40:37] Chew: has joined #ruby
[21:43:41] ur5us: has joined #ruby
[21:45:31] Nicmavr: has joined #ruby
[21:46:26] orbyt_: has joined #ruby
[21:47:34] nevada1: has left #ruby: ()
[22:02:00] doodlebug: has joined #ruby
[22:07:44] weird_error: has joined #ruby
[22:11:41] Nicmavr: has joined #ruby
[22:15:02] SCHAPiE: has joined #ruby
[22:20:23] m_antis: has joined #ruby
[22:25:39] sauvin: has joined #ruby
[22:30:17] weird_error: has joined #ruby
[22:31:10] bikes: has joined #ruby
[22:31:38] Freshnuts: has joined #ruby
[22:33:52] doodleb87: has joined #ruby
[22:34:25] doodlebug: has joined #ruby
[22:35:54] esp32_prog: has joined #ruby
[22:39:06] Renich: has joined #ruby
[22:41:48] weird_error: has joined #ruby
[22:51:04] weird_error: has joined #ruby
[23:02:01] fphilipe: has joined #ruby
[23:07:15] mochiyoda: has joined #ruby
[23:11:41] Nicmavr: has joined #ruby
[23:12:16] bikes: has joined #ruby
[23:23:48] houhoulis: has joined #ruby
[23:25:46] planigan: has joined #ruby
[23:27:26] FancyEagle: has joined #ruby
[23:32:54] dar123: has joined #ruby
[23:34:27] xco: has joined #ruby
[23:36:41] SeepingN: has joined #ruby
[23:41:42] Kestrel-029: has joined #ruby
[23:47:34] esp32_prog: has joined #ruby
[23:47:57] orbyt_: has joined #ruby
[23:48:41] weird_error: has joined #ruby