« Back to channel list

#ruby - 12 May 2018

« Back 1 day Forward 1 day »
[00:04:27] caleBOT__: has joined #ruby
[00:04:27] caleBOT_: has joined #ruby
[00:04:48] houhoulis: has joined #ruby
[00:06:28] dogweather: has joined #ruby
[00:12:31] emilford: has joined #ruby
[00:13:42] dstrunk: has joined #ruby
[00:16:30] chocoelho1: has joined #ruby
[00:18:11] alfiemax: has joined #ruby
[00:19:49] dogweather: has joined #ruby
[00:20:45] jokke1: has joined #ruby
[00:20:55] cagomez: has joined #ruby
[00:23:48] mikecmpbll: has joined #ruby
[00:23:56] Puppet`: has joined #ruby
[00:28:09] cagomez: has joined #ruby
[00:28:20] dogweather: has joined #ruby
[00:28:44] Puppet`: has joined #ruby
[00:32:53] nowhere_man: has joined #ruby
[00:38:23] jenrzzz: has joined #ruby
[00:38:23] jenrzzz: has joined #ruby
[00:44:47] Puppet`: has joined #ruby
[00:52:53] tAn: has joined #ruby
[00:55:54] raynold: has joined #ruby
[01:03:15] n0m4d1c: has joined #ruby
[01:07:50] Ian: has joined #ruby
[01:18:18] tdy: has joined #ruby
[01:19:03] sysop: has joined #ruby
[01:20:43] TinkerT: has joined #ruby
[01:22:37] Azure|dc: has joined #ruby
[01:23:31] cagomez: has joined #ruby
[01:24:07] Jameser: has joined #ruby
[01:25:50] RougeR: has joined #ruby
[01:27:20] Jameser: has joined #ruby
[01:28:01] jenrzzz_: has joined #ruby
[01:30:21] yxhuvud: has joined #ruby
[01:39:18] darkhanb: has joined #ruby
[01:46:25] dinfuehr: has joined #ruby
[01:47:22] alfiemax: has joined #ruby
[01:51:27] kapil___: has joined #ruby
[01:51:44] yxhuvud: has joined #ruby
[01:52:16] gizmore|2: has joined #ruby
[01:55:02] roamingdog: has joined #ruby
[01:55:39] roamingdog: has joined #ruby
[01:56:29] roamingdog: has joined #ruby
[01:57:14] roamingdog: has joined #ruby
[01:57:22] mrush: has joined #ruby
[01:58:04] roamingdog: has joined #ruby
[02:03:22] banisterfiend: has joined #ruby
[02:03:23] garyserj: What does this mean if 3==3 then "gg" end Like no puts for example.
[02:03:23] nicesignal: has joined #ruby
[02:05:54] yxhuvud: has joined #ruby
[02:06:19] mozzarella: garyserj: it means the branch evaluates to "gg"
[02:06:25] havenwood: garyserj: You could write that: 'gg' if 3 == 3
[02:06:37] havenwood: garyserj: Or: 3 == 3 && 'gg'
[02:07:09] havenwood: garyserj: The statement will return `'gg'` or `nil`.
[02:07:13] mozzarella: >> puts (if true then 1 else 2 end)
[02:07:14] ruby[bot]: mozzarella: # => 1 ...check link for more (https://eval.in/1003033)
[02:09:21] Vashy: garyserj, it returns the string "gg"
[02:09:37] Vashy: oh someone already said that nvm
[02:09:40] havenwood: You could shorten it to: "gg"
[02:09:51] havenwood: TruffleRuby would!
[02:11:56] jsrtr: has joined #ruby
[02:13:48] garyserj: yes I understand programming languages, but ruby seems a bit different in the statement returning something
[02:14:37] garyserj: suppose I have a function r=def abc1; puts "gg"; end Then can I execute it through r?
[02:14:39] mozzarella: constructs that would be statements in other languages are expressions in ruby
[02:14:51] alfiemax: has joined #ruby
[02:15:48] mozzarella: def returns a symbol AFAIK
[02:15:55] mozzarella: the name of the function
[02:16:18] mozzarella: >> def abc1; end
[02:16:20] ruby[bot]: mozzarella: # => :abc1 (https://eval.in/1003034)
[02:16:45] havenwood: >> r=def abc1; puts "gg"; end; public_send r
[02:16:47] ruby[bot]: havenwood: # => private method `abc1' called for main:Object (NoMethodError) ...check link for more (https://eval.in/1003035)
[02:16:53] havenwood: >> r=def abc1; puts "gg"; end; send r
[02:16:54] ruby[bot]: havenwood: # => gg ...check link for more (https://eval.in/1003036)
[02:17:05] Jameser: has joined #ruby
[02:18:07] havenwood: for some reason eval.in doesn't see public methods on main
[02:19:33] havenwood: 20>> def old; end
[02:19:34] ruby[bot]: havenwood: # => nil (https://eval.in/1003038)
[02:19:41] havenwood: 21>> def new; end
[02:19:42] ruby[bot]: havenwood: # => :new (https://eval.in/1003039)
[02:22:06] mozzarella: thought the behavior had changed… glad to know I'm not crazy
[02:28:09] _aeris_: has joined #ruby
[02:47:04] cadillac_: has joined #ruby
[02:47:10] Jameser: has joined #ruby
[02:48:20] cschneid_: has joined #ruby
[02:50:14] rkazak: has joined #ruby
[02:51:41] alfiemax: has joined #ruby
[02:55:10] alfiemax_: has joined #ruby
[02:55:48] xuanrui: has joined #ruby
[03:00:15] cadillac_: has joined #ruby
[03:02:08] cthu|: has joined #ruby
[03:06:08] bmurt: has joined #ruby
[03:11:30] chris349: has joined #ruby
[03:11:38] Cyrus: has joined #ruby
[03:12:01] chris349: has joined #ruby
[03:13:03] chris349: I have a rake task that runs fine from a crontab, but its getting to complex so I want to move it to a shell script. I copy all the env variables from my crontab, such as RAILS_ENV, but when I run the script it errors out because its not running in the right RAILS_ENV
[03:13:20] chris349: Why is it ignoring this from a shell script but working fine in a crontab?
[03:16:36] Dimik: has joined #ruby
[03:17:02] nielsk: has joined #ruby
[03:17:55] elomatreb: Are you absolutely sure you're setting the rails env correctly? (i.e. is it actually exported?)
[03:18:19] cadillac_: has joined #ruby
[03:20:17] arekushi: has joined #ruby
[03:21:54] chris349: eldritch, I dont export it in the crontab. Whats the right way to export it in a shell script?
[03:23:36] tAn: has joined #ruby
[03:29:57] sanscoeur: has joined #ruby
[03:34:58] Jacky: has joined #ruby
[03:40:59] cadillac_: has joined #ruby
[03:44:46] jenrzzz: has joined #ruby
[03:44:47] jenrzzz: has joined #ruby
[03:45:10] caleBOT_: has joined #ruby
[03:45:10] caleBOT: has joined #ruby
[03:45:23] gix: has joined #ruby
[03:47:25] cadillac_: has joined #ruby
[03:51:36] dinfuehr: has joined #ruby
[03:55:12] govg: has joined #ruby
[03:57:18] dinfuehr: has joined #ruby
[03:58:06] twe4ked: has joined #ruby
[04:06:32] dinfuehr: has joined #ruby
[04:06:39] cadillac_: has joined #ruby
[04:08:32] Asher: has joined #ruby
[04:13:04] papajo: has joined #ruby
[04:14:42] elomatreb: chris349: Sorry, missed your reply. You need to either call it in the line where you invoke rails (RAILS_ENV=something rake sometask), or export the variable in general (export RAILS_ENV=something). Otherwise it's local to your shell script, and spawned child processes do not know about it
[04:15:28] ciscam: has joined #ruby
[04:16:26] shynoob: has joined #ruby
[04:17:48] shynoob: what's the best linux distro to run on server for rails deployment??
[04:25:34] cadillac_: has joined #ruby
[04:28:24] roamingdog: has joined #ruby
[04:39:25] Jameser: has joined #ruby
[04:45:12] tacoboy: has joined #ruby
[04:59:29] Ryzokuken: has joined #ruby
[04:59:39] cadillac_: has joined #ruby
[05:03:34] segy: has joined #ruby
[05:04:24] Jameser: has joined #ruby
[05:08:32] rkazak: has joined #ruby
[05:14:52] cadillac_: has joined #ruby
[05:16:24] sauvin: has joined #ruby
[05:20:17] SuperLag: has joined #ruby
[05:29:28] roamingdog: has joined #ruby
[05:34:25] cadillac_: has joined #ruby
[05:45:47] Jameser: has joined #ruby
[05:45:58] roamingdog: has joined #ruby
[05:47:07] qnaal: has joined #ruby
[05:52:15] rippa: has joined #ruby
[05:52:48] konsolebox: has joined #ruby
[05:53:56] tAn: has joined #ruby
[05:59:05] Vashy: I'm trying to write my first gem, to parse the output of "lspci"
[06:00:29] Vashy: so I had ruby mine create a new gem project for me
[06:00:38] Vashy: I decided to name the project ruby-lspci
[06:00:59] Vashy: but it ended up creating a module structure kind of like this: Ruby::Lspci
[06:01:30] Vashy: is it bad to have the top level module be called Ruby?
[06:02:04] baweaver: high chance of someone else intersecting it by accident
[06:02:23] Vashy: I'll have to refactor then
[06:02:42] baweaver: you could always make Lspci the top namespace as well
[06:02:53] Vashy: yeah I think that's what I'll have to do
[06:02:59] baweaver: dashes in a gem name indicate parent -> child
[06:03:04] Vashy: also, is there documentation or convention on how a project should be structured?
[06:03:10] Vashy: oic I didn't know that
[06:07:54] Vashy: baweaver, if I refactor the code to no longer use the Ruby namespace, is it okay to keep the name of the project/gem as 'ruby-lspci' ?
[06:08:15] baweaver: you'll anger the eldergods
[06:08:19] baweaver: na, probably fine
[06:08:30] baweaver: I've seen other people do the same thing
[06:08:34] Vashy: I'll reread the naming conventions page on rubygems just to make sure
[06:08:52] baweaver: Personally I find it redundant
[06:09:07] baweaver: by merit of installing or making a gem it's known to be ruby
[06:09:26] andikr: has joined #ruby
[06:11:58] zautomata1: has joined #ruby
[06:15:26] howdoi: has joined #ruby
[06:26:50] elomatreb: Vashy: The Rubygems guides recommend underscores for word separation: https://guides.rubygems.org/name-your-gem/
[06:29:47] Jameser: has joined #ruby
[06:30:11] Vashy: yeah I was just reading that
[06:30:13] Vashy: thanks elomatreb =)
[06:30:41] Alex: has joined #ruby
[06:32:18] twe4ked: has joined #ruby
[06:53:43] tvw: has joined #ruby
[06:54:58] suukim: has joined #ruby
[06:56:06] blackmesa: has joined #ruby
[06:57:32] agent_white: has joined #ruby
[06:57:47] armyriad: has joined #ruby
[07:03:03] apeiros: has joined #ruby
[07:03:04] ciscam: has joined #ruby
[07:03:55] schleppel: has joined #ruby
[07:09:36] RedNifre: has joined #ruby
[07:13:02] caleBOT: has joined #ruby
[07:13:03] caleBOT_: has joined #ruby
[07:26:37] dionysus69: has joined #ruby
[07:29:01] cadillac_: has joined #ruby
[07:35:29] Vashy: published a gem and got 6 downloads in a few mins...
[07:35:35] Vashy: is that normal? bots crawling or something?
[07:45:13] cadillac_: has joined #ruby
[07:47:16] Hanmac: has joined #ruby
[07:52:41] Immune: has joined #ruby
[07:52:47] kmurphy4: has joined #ruby
[07:55:45] Hanmac: in case of https://bugs.ruby-lang.org/issues/14249 is there someone else beside me that uses this? str[match_str]
[07:55:55] drale2k_: has joined #ruby
[07:56:30] Immune: has joined #ruby
[08:03:05] qnaal: has joined #ruby
[08:04:57] c0ncealed1: has joined #ruby
[08:05:12] marr: has joined #ruby
[08:07:35] ur5us: has joined #ruby
[08:08:47] ur5us: has joined #ruby
[08:09:04] cadillac_: has joined #ruby
[08:09:30] apparition: has joined #ruby
[08:10:36] dminuoso: hanmac: Why would you use or rely on this
[08:22:32] cadillac_: has joined #ruby
[08:25:10] tAn: has joined #ruby
[08:26:24] tomphp: has joined #ruby
[08:36:30] emilford: has joined #ruby
[08:37:38] biberu: has joined #ruby
[08:37:39] TomyLobo: has joined #ruby
[08:44:37] conta: has joined #ruby
[08:50:20] jamesaxl: has joined #ruby
[08:50:40] ur5us: has joined #ruby
[08:52:45] mikecmpbll: has joined #ruby
[09:06:58] DTZUZO_: has joined #ruby
[09:11:46] qnaal: has joined #ruby
[09:12:00] Quentinius: has joined #ruby
[09:12:35] apeiros: hanmac: I'm aware this exists, but I've never used it and I don't remember seeing it in use. I think I'd use String#include? instead of String#[String] (at least I can't imagine a use case where it's not a test for inclusion)
[09:13:10] ellcs: has joined #ruby
[09:13:16] gr33n7007h: has joined #ruby
[09:13:25] apeiros: otoh I don't see a reason to remove it just because somebody got confused
[09:18:23] dminuoso: apeiros: A language shouldn't clean up its mess and toss out old and bad garbage?
[09:18:31] dminuoso: ACTION eyeballs C and JavaScript
[09:18:58] apeiros: dminuoso: it should. but I wouldn't call String#[String] a high priority target in that
[09:25:08] cadillac_: has joined #ruby
[09:35:30] amar: has joined #ruby
[09:36:35] plexigras: has joined #ruby
[09:38:09] roamingdog: has joined #ruby
[09:40:19] joro_: has joined #ruby
[09:40:59] joro_: hi guys, does anyone know how network_interface gem works ?
[09:41:34] ineb: has joined #ruby
[09:43:30] joro_: the problem is that it returns the wrong network interface
[09:46:24] RedNifre: has joined #ruby
[09:46:33] caleBOT_: has joined #ruby
[09:46:34] caleBOT__: has joined #ruby
[09:46:46] ciscam: has joined #ruby
[09:47:30] c_nick: has joined #ruby
[09:48:56] cschneid_: has joined #ruby
[09:54:06] mohsen_1: has joined #ruby
[09:59:15] tomphp: has joined #ruby
[10:00:55] al2o3-cr: joro_: how so?
[10:01:42] al2o3-cr: NetworkInterface.interfaces returns an array of interfaces names.
[10:01:50] sameerynho: has joined #ruby
[10:05:10] joro_: al2o3-cr, i am not familliar with ruby to be honnest, i just found this https://pastebin.com/FeqFS98r
[10:05:10] ruby[bot]: joro_: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
[10:05:47] jnollette: has joined #ruby
[10:07:08] joro_: how to paste in https://gist.github.com
[10:07:54] apeiros: sadly since a few weeks ago they require registration for gist :(
[10:08:19] apeiros: we might change the bot's reaction to pastebin due to that :-/
[10:08:32] joro_: i have reg in github
[10:09:01] al2o3-cr: joro_: make sure you're logged in then.
[10:09:13] apeiros: then all you have to do is go to gist.github.com, log in and paste
[10:09:47] joro_: https://gist.github.com/m113v/83207bde165b5ad5b4bfc90494ca9796
[10:10:23] Zaab1t: has joined #ruby
[10:10:51] plexigras: has joined #ruby
[10:10:53] ipe: has joined #ruby
[10:11:51] joro_: #{interface} return wlp1s0 which is wrong due to fact that ip addr returns wlp2s0
[10:12:16] al2o3-cr: joro_: that isn't even using the network_interface gem. that is loading yaml with returns a hash then accessing the key network_interface from the secrets hash.
[10:13:45] joro_: i was just guessing, but any idea why does it return wlp1s0 ?
[10:14:37] al2o3-cr: take a look at the secrets.yml
[10:17:25] joro_: ok, i found it, thanks you
[10:20:41] al2o3-cr: what a useless use of cat
[10:22:58] karapetyan: has joined #ruby
[10:25:57] joro_: how else...can you get the nameserver except from resolv.conf then ?
[10:26:08] RedNifre: has joined #ruby
[10:27:31] apeiros: joro_: eh, cat | grep -> just grep the file directly
[10:30:05] apeiros: or in plain ruby: File.read("/etc/resolv.conf").scan(/^nameserver (.*)/).map(&:first) # there may be nicer solutions than this
[10:30:29] donofrio: has joined #ruby
[10:30:47] apeiros: oh, right: File.foreach("/etc/resolv.conf").grep(/^nameserver (.*)/) { $1 }
[10:31:50] joro_: will that work if resolv.conf requires root ?
[10:32:15] apeiros: if your shellout works, this will work too
[10:32:41] apeiros: unless you setuid'ed your cat, which would be a terrible idea.
[10:32:46] joro_: vim /etc/resolv.conf doesnt work
[10:33:03] apeiros: "doesn't work" is a useless description.
[10:33:04] joro_: it requires sudo
[10:34:36] karapetyan: has joined #ruby
[10:34:43] apeiros: I don't know what vim tries to do. but apparently more than just read the file.
[10:35:24] joro_: it depends on the mode
[10:35:36] apeiros: anyway, your subshell does not have more rights than the application running the subshell. so again: if your shellout works, this will work too
[10:36:37] apeiros: and I mean you can just like… try it?
[10:38:09] joro_: it's not a big deal... i was just asking al2o3-cr about the useless cat... i am not familliar with ruby at all
[10:38:25] apeiros: I explained you?
[10:38:31] apeiros: 12:27 apeiros: joro_: eh, cat | grep -> just grep the file directly
[10:39:06] joro_: apeiros, thanks you :) why do you need to be mad ?
[10:39:19] apeiros: why you think I am?
[10:42:01] al2o3-cr: joro_: hes not mad, he turns green when hes mad :P
[10:42:33] apeiros: I have to asks somebody to take a picture of me when I'm mad, I want to see that 😂
[10:45:30] schneider: has joined #ruby
[10:47:57] al2o3-cr: joro_: require 'resolv'; Resolv::DNS::Config.new.lazy_initialize.nameserver_port # will get you an array of namerservers and ports
[10:51:15] ur5us: has joined #ruby
[10:53:11] drale2k_: has joined #ruby
[10:58:52] al2o3-cr: joro_: you can read, you just can't write to resolv.conf without root priviledges
[11:02:03] joro_: al2o3-cr, yes, my mistake
[11:02:15] al2o3-cr: joro_: no worries. ;)
[11:02:20] InfinityFye: has joined #ruby
[11:04:02] joro_: guys, is ruby-gmail secured ?
[11:05:16] guille-moe: has joined #ruby
[11:11:29] ellcs: has joined #ruby
[11:13:24] ellcs: has left #ruby: ()
[11:15:21] InfinityFye: has left #ruby: ("Leaving")
[11:16:19] ciscam: has joined #ruby
[11:28:25] Prutheus: has joined #ruby
[11:28:48] Prutheus: Hello. I want to exit an if block before reaching end if an condition inside the if block matches.
[11:28:57] Prutheus: how to break out of an if block? with break, it does not work
[11:34:47] apeiros: prutheus: put the rest of the code in another if/end
[11:35:07] apeiros: alternatively: gist your code
[11:35:12] Prutheus: nah, i jsut wrap the code inside the if into a labmda block where i can use break inside
[11:36:29] apeiros: mid code break/returns are spaghetti code. you shouldn't do that. but it's of course your decision.
[11:36:47] Prutheus: why should i not do that?
[11:37:13] apeiros: google "spaghetti code", there are most certainly good existing explanations
[11:37:49] Prutheus: but hwy is that bad code? https://bpaste.net/show/b66c5fada1e1
[11:39:30] Alex: has joined #ruby
[11:39:33] apeiros: as said, google spaghetti code. in short: because it's convoluted and hard to read. which in turn makes it hard to maintain.
[11:39:46] Prutheus: but is my example ahrd to read? no
[11:39:50] Prutheus: its absolute easy and logical
[11:39:56] apeiros: if you say so.
[11:40:01] Prutheus: so i dotn know how else i should program that piece
[11:40:34] apeiros: apparently it's already the pinnacle of logic and ease. so there's no need.
[11:46:40] gheegh: has joined #ruby
[11:47:58] segy: has joined #ruby
[11:52:17] GodFather: has joined #ruby
[11:56:32] caleBOT_: has joined #ruby
[11:56:32] caleBOT: has joined #ruby
[11:57:59] samosaphile: has joined #ruby
[12:07:34] tAn: has joined #ruby
[12:08:50] RedNifre: has joined #ruby
[12:19:05] gr33n7007h: has joined #ruby
[12:21:09] dr3wo: has joined #ruby
[12:22:14] cagomez: has joined #ruby
[12:22:56] physicist__: has joined #ruby
[12:22:58] GodFather: has joined #ruby
[12:31:59] ldepandis: has joined #ruby
[12:32:47] qnaal: has joined #ruby
[12:33:01] jottr: has joined #ruby
[12:33:32] RougeR: has joined #ruby
[12:33:32] RougeR: has joined #ruby
[12:37:50] za1b1tsu_: has joined #ruby
[12:51:19] AJA4350: has joined #ruby
[12:52:02] ur5us: has joined #ruby
[12:53:00] DTZUZO_: has joined #ruby
[12:59:16] Mike11: has joined #ruby
[12:59:26] houhoulis: has joined #ruby
[13:00:03] houhoulis: has joined #ruby
[13:00:33] Asher: has joined #ruby
[13:05:52] Jameser: has joined #ruby
[13:23:30] venmx: has joined #ruby
[13:24:37] jottr: has joined #ruby
[13:26:10] m27frogy: has joined #ruby
[13:28:54] nfsnobody: has joined #ruby
[13:28:54] Voxxit: has joined #ruby
[13:29:36] quobo: has joined #ruby
[13:30:52] dinfuehr: has joined #ruby
[13:30:56] ciscam: has joined #ruby
[13:30:58] d^sh: has joined #ruby
[13:31:32] gil_: has joined #ruby
[13:34:29] jsaak: has joined #ruby
[13:36:52] alfiemax: has joined #ruby
[13:41:02] DoubleMalt: has joined #ruby
[13:45:49] redlegion[m]: has joined #ruby
[13:46:27] konsolebox: has joined #ruby
[13:50:45] n0m4d1c: has joined #ruby
[13:51:13] Janky: has joined #ruby
[13:54:15] roamingdog: has joined #ruby
[13:56:36] caleBOT: has joined #ruby
[13:56:37] caleBOT_: has joined #ruby
[13:57:44] drale2k_: has joined #ruby
[14:00:32] Asher: has joined #ruby
[14:01:20] jottr: has joined #ruby
[14:02:56] gheegh: has joined #ruby
[14:03:37] redlegion: has joined #ruby
[14:07:26] RedNifre: has joined #ruby
[14:08:16] nickjj: has joined #ruby
[14:09:20] apeiros: has joined #ruby
[14:15:28] apparition: has joined #ruby
[14:16:54] Hanmac: apeiros: the difference is the return value
[14:17:07] intheclouddan: has joined #ruby
[14:17:07] iceskins[m]: has joined #ruby
[14:17:07] aviraldg: has joined #ruby
[14:17:07] Hanma[m]: has joined #ruby
[14:17:07] Giphy[m]: has joined #ruby
[14:17:07] jonjits[m]: has joined #ruby
[14:17:07] torarne: has joined #ruby
[14:17:08] haylon_: has joined #ruby
[14:17:08] failednoose[m]: has joined #ruby
[14:17:08] luna_x[m]: has joined #ruby
[14:17:08] velu_aon[m]: has joined #ruby
[14:17:08] turt2live: has joined #ruby
[14:17:08] KevinMGranger: has joined #ruby
[14:17:14] nullmoose[m]: has joined #ruby
[14:17:14] zalipuha[m]: has joined #ruby
[14:17:43] coderphive: has joined #ruby
[14:25:09] ellcs: has joined #ruby
[14:28:39] Dimik: has joined #ruby
[14:37:09] venmx: has joined #ruby
[14:39:04] tAn: has joined #ruby
[14:39:33] alfiemax: has joined #ruby
[14:42:52] rkazak: has joined #ruby
[14:45:48] DoubleMalt: has joined #ruby
[14:46:41] Ryzokuken: has joined #ruby
[14:47:43] pilne: has joined #ruby
[14:49:18] RedNifre: has joined #ruby
[14:55:45] apeiros: hanmac: sure. but when do you need that? you already have the needle. almost certainly in a variable even.
[14:55:48] arekushi: has joined #ruby
[14:56:04] qnaal: has joined #ruby
[14:56:09] apeiros: and .include? is much more communicative about the intent
[14:56:19] apeiros: much more intent revealing?
[14:56:54] Hanmac: str[needle] || otherStr vs str.include?(needle) ? needle : otherStr ?
[14:57:21] konsolebox: ^ i prefer the first
[14:57:31] apeiros: I prefer second
[14:57:50] apeiros: mostly because I know ~70%+ of ruby devs would have to consult docs to understand the first
[14:58:05] apeiros: falls into the category: don't write clever code.
[15:07:46] RougeR: has joined #ruby
[15:07:47] RougeR: has joined #ruby
[15:08:37] za1b1tsu_: has joined #ruby
[15:10:07] houhoulis: has joined #ruby
[15:12:47] konsolebox: apeiros: you honestly find that clever and never wrote a code like that? because i find that very basic when it comes to scripting.
[15:13:20] konsolebox: it also has similar "cleverness" to ||=. actually, it's less.
[15:15:53] Asher: has joined #ruby
[15:17:09] nickjj: has joined #ruby
[15:19:58] ramfjord: has joined #ruby
[15:20:03] al2o3-cr: it's not clever code it's ruby ;)
[15:20:48] caleBOT_: has joined #ruby
[15:20:48] caleBOT: has joined #ruby
[15:21:10] caleBOT__: has joined #ruby
[15:21:10] caleBOT__: has joined #ruby
[15:24:29] kmurphy4_: has joined #ruby
[15:24:31] gheegh: has joined #ruby
[15:25:50] goepsilongo: has joined #ruby
[15:25:55] nickjj: has joined #ruby
[15:27:28] amar: has joined #ruby
[15:32:24] qnaal: has joined #ruby
[15:32:37] konsolebox: al2o3-cr: both methods are ruby and are well-documented. one is just frowned upon by the "community" because of a collective philosophy or myth, or laziness to learn complete ruby programming knowledge. like a tribunal, they try to define how ruby should work.
[15:33:35] al2o3-cr: konsolebox: aye, and i'd agree String#[] has my vote :p
[15:34:10] al2o3-cr: but each to their own.
[15:34:42] dstrunk: has joined #ruby
[15:36:11] al2o3-cr: but not that it matters.
[15:38:14] al2o3-cr: if they're a ruby dev they should know this shit tbqf
[15:38:55] Omnilord: If the language provides a useful tool, and new developers don't know how to use it, then yes, they will have to reach for the docs. How else will they learn the language?
[15:39:43] havenwood: >> hay = 'xyz'; needle = 'y'; hay[needle].equal? needle
[15:39:44] ruby[bot]: havenwood: # => false (https://eval.in/1003167)
[15:40:20] za1b1tsu_: has joined #ruby
[15:40:38] Dimik: has joined #ruby
[15:40:44] al2o3-cr: >> hay = 'xyz'; needle = 'y'; hay[needle].eql? needle
[15:40:45] ruby[bot]: al2o3-cr: # => true (https://eval.in/1003168)
[15:41:04] havenwood: my point is it's a different object
[15:41:15] apeiros: konsolebox: ||= is an established idiom. String#[String] is not.
[15:41:20] konsolebox: al2o3-cr: i think i misread what you said. i thought you referred to ||= not being clever but ruby, hence i tried to explain that ||= is as documented as ||, in the sense that || can be used to define a fallback value..
[15:41:43] havenwood: >> hay = 'xyz'; needle = 'y'; hay[needle].object_id != needle.object_id
[15:41:44] ruby[bot]: havenwood: # => true (https://eval.in/1003169)
[15:41:50] al2o3-cr: konsolebox: no worries, yeah was slightly confused there for a minute
[15:41:59] konsolebox: apeiros: yes obviously, but i compared not by how one is established or not, but the complexity on their mechanism.
[15:42:02] havenwood: Cleverness aside, it's allocating new Strings.
[15:42:06] al2o3-cr: havenwood: i see your point now
[15:42:08] konsolebox: *compared them
[15:42:16] apeiros: konsolebox: in that case, you're missing the point completely
[15:42:38] apeiros: code readability vs cleverness is not depending on the complexity of the involved mechanism.
[15:42:55] apeiros: or rather, not only
[15:42:59] al2o3-cr: obviously String#[] return a new sub-string.
[15:43:19] konsolebox: apeiros: because one became more popular?
[15:43:35] apeiros: konsolebox: still missing the point
[15:43:43] apeiros: you can use concise clever constructs if they're popular
[15:43:50] konsolebox: yeah, whatever you think i'm missing is trivial
[15:44:00] apeiros: if it's not popular, be explicit
[15:44:14] apeiros: and String#[String] is not popular and everything else than explicit.
[15:44:26] al2o3-cr: anyway discussion aside, it's a beutiful day to today :)
[15:44:36] apeiros: yupp, that's why I was just jogging :D
[15:45:05] konsolebox: apeiros: well popularity is not the only factor in my opinion. it's also about the requirement for being a basic ruby programmer, and how easy it is to follow code. especially if they are just using basic syntax. it doesn't even involve multiple methods.
[15:45:18] al2o3-cr: apeiros: keep it up, you'll be running marathons soon ;P
[15:45:28] apeiros: al2o3-cr: I already ran half marathons
[15:45:40] apeiros: but I don't think I'll ever run marathons
[15:45:43] al2o3-cr: apeiros: what's that 13 mile?
[15:45:51] apeiros: what's a mile? :-p
[15:46:12] al2o3-cr: impressive ;)
[15:46:30] apeiros: I plan to finally run it <2h this year
[15:46:45] al2o3-cr: yeah 21km is roughly 13 mile ;P
[15:46:58] apeiros: 1.6km/mile, right?
[15:47:57] apeiros: konsolebox: yes, I'd expect any halfway decent ruby programmer to be able to follow it. but code where I have to look up half of the methods in order to understand it is - even if I can perfectly follow it - not readable code.
[15:48:37] robertot1: has joined #ruby
[15:49:43] apeiros: that's also one reason while extracting into methods is a great pattern (and another where I don't know whether it's even got a name: assign to well named local variables). it gives information about intent. which means even if I don't know one or two methods, I can infer from context.
[15:50:26] havenwood: I'd not use String#[match_str] unless I meant to create a new substring object.
[15:50:53] havenwood: We could patch it to return match_str, but that'd be breaking behavior.
[15:51:05] redlegion: has joined #ruby
[15:51:16] apeiros: havenwood: you mean when you want a copy?
[15:51:39] konsolebox: havenwood: yeah, i admit you got a winning point about the new instance
[15:51:45] apeiros: out of curiosity: do you have examples where you used it like that?
[15:51:59] havenwood: apeiros: no, i'd probably end up writing it more explicitly
[15:52:21] apeiros: ok, I did giggle a bit there
[15:52:25] apeiros: ACTION brb
[15:52:41] gheegh: has joined #ruby
[15:56:03] gheegh: has joined #ruby
[15:57:08] al2o3-cr: >> $$-->{0}[]<--$$/$$
[15:57:08] ruby[bot]: al2o3-cr: # => false (https://eval.in/1003171)
[15:59:29] conta: has joined #ruby
[16:03:22] cagomez: has joined #ruby
[16:04:48] venmx: has joined #ruby
[16:07:47] caleBOT: has joined #ruby
[16:07:48] caleBOT_: has joined #ruby
[16:14:00] dstrunk: has joined #ruby
[16:15:52] za1b1tsu_: has joined #ruby
[16:19:10] RedNifre: has joined #ruby
[16:20:11] gheegh: has joined #ruby
[16:24:25] robertot1: has joined #ruby
[16:24:48] caleBOT: has joined #ruby
[16:25:18] caleBOT: has joined #ruby
[16:25:19] caleBOT_: has joined #ruby
[16:28:30] caleBOT__: has joined #ruby
[16:28:31] caleBOT__: has joined #ruby
[16:28:33] alfiemax: has joined #ruby
[16:34:36] venmx: has joined #ruby
[16:41:15] gheegh: has joined #ruby
[16:45:14] dionysus69: has joined #ruby
[16:48:16] orbyt_: has joined #ruby
[16:49:23] conta: has joined #ruby
[16:55:07] alfiemax: has joined #ruby
[16:55:45] guille-moe: has joined #ruby
[17:01:59] robertot1: has joined #ruby
[17:07:21] conta: has joined #ruby
[17:08:15] cyberg: has joined #ruby
[17:09:02] tAn: has joined #ruby
[17:09:06] cadillac_: has joined #ruby
[17:12:47] sphenxes: has joined #ruby
[17:13:10] conta: has joined #ruby
[17:14:16] guille-moe: has joined #ruby
[17:14:34] robertot1: has joined #ruby
[17:18:57] puppet645: has joined #ruby
[17:21:22] conta: has joined #ruby
[17:24:09] dr3wo: has joined #ruby
[17:25:02] conta: has joined #ruby
[17:28:42] alfiemax: has joined #ruby
[17:29:36] garyserj: has joined #ruby
[17:30:06] guille-moe: has joined #ruby
[17:31:19] gheegh: has joined #ruby
[17:31:55] za1b1tsu_: has joined #ruby
[17:32:59] robertot1: has joined #ruby
[17:33:26] conta: has joined #ruby
[17:35:15] conta: has joined #ruby
[17:38:07] gheegh: has joined #ruby
[17:39:13] alfiemax_: has joined #ruby
[17:42:36] robertot1: has joined #ruby
[17:44:58] Sembei: has joined #ruby
[17:49:40] conta: has joined #ruby
[17:55:31] conta: has joined #ruby
[17:56:57] RedNifre: has joined #ruby
[17:57:55] gheegh: has joined #ruby
[18:00:18] tomphp: has joined #ruby
[18:03:46] za1b1tsu_: has joined #ruby
[18:03:54] conta: has joined #ruby
[18:05:14] robertot1: has joined #ruby
[18:10:24] sepp2k: has joined #ruby
[18:10:50] robertot1: has joined #ruby
[18:14:46] sphenxes: has joined #ruby
[18:15:17] govg: has joined #ruby
[18:16:32] ramfjord: has joined #ruby
[18:21:04] gheegh: has joined #ruby
[18:25:54] roamingdog: has joined #ruby
[18:37:12] robertot1: has joined #ruby
[18:44:09] drale2k_: has joined #ruby
[18:44:35] caleBOT_: has joined #ruby
[18:44:35] caleBOT: has joined #ruby
[18:45:11] sphenxes: has joined #ruby
[18:45:14] dionysus69: has joined #ruby
[18:46:34] cagomez: has joined #ruby
[18:48:29] cagomez: has joined #ruby
[18:50:12] tomphp: has joined #ruby
[19:02:52] tomphp: has joined #ruby
[19:03:47] amar: has joined #ruby
[19:04:38] gheegh: has joined #ruby
[19:05:28] tomaw: has joined #ruby
[19:08:03] cagomez: has joined #ruby
[19:11:05] kies^: has joined #ruby
[19:11:41] caleBOT_: has joined #ruby
[19:11:41] caleBOT: has joined #ruby
[19:15:17] robertot1: has joined #ruby
[19:16:09] tomphp: has joined #ruby
[19:17:04] rkazak: has joined #ruby
[19:21:19] kmurphy4_: has joined #ruby
[19:23:43] conta: has joined #ruby
[19:26:47] caleBOT_: has joined #ruby
[19:26:47] caleBOT: has joined #ruby
[19:27:08] caleBOT__: has joined #ruby
[19:27:08] caleBOT__: has joined #ruby
[19:28:52] vladdypwnz: has joined #ruby
[19:29:08] riskish: has joined #ruby
[19:31:29] sepp2k1: has joined #ruby
[19:39:49] tAn: has joined #ruby
[19:42:18] vladdypwnz: has joined #ruby
[19:42:32] robertothais: has joined #ruby
[19:43:01] vladdypwnz: has joined #ruby
[19:43:23] Zaab1t1: has joined #ruby
[19:47:40] Lytol: has joined #ruby
[19:48:10] minimalism: has joined #ruby
[19:48:25] Emmanuel_Chanel: has joined #ruby
[19:48:54] Emmanuel_Chanel: has joined #ruby
[19:49:44] RougeR: has joined #ruby
[19:49:45] RougeR: has joined #ruby
[19:50:03] DoubleMalt: has joined #ruby
[19:52:28] ellcs: has joined #ruby
[19:52:56] rivalomega: has joined #ruby
[19:54:39] coderphive: has joined #ruby
[19:56:43] caleBOT: has joined #ruby
[19:56:44] caleBOT_: has joined #ruby
[20:02:21] Ryzokuken: has joined #ruby
[20:04:00] caleBOT: has joined #ruby
[20:04:01] caleBOT_: has joined #ruby
[20:04:24] caleBOT__: has joined #ruby
[20:04:24] caleBOT__: has joined #ruby
[20:05:18] tAn: has joined #ruby
[20:11:07] zapata: has joined #ruby
[20:18:43] ramfjord: has joined #ruby
[20:22:26] amar_: has joined #ruby
[20:23:35] rivalomega: has joined #ruby
[20:26:22] guille-moe: has joined #ruby
[20:27:37] roamingdog: has joined #ruby
[20:28:45] sammi`: has joined #ruby
[20:30:34] robertothais: has joined #ruby
[20:31:07] alex``: has joined #ruby
[20:31:48] eckhardt: has joined #ruby
[20:35:53] guille-moe: has joined #ruby
[20:36:01] Quentinius: has joined #ruby
[20:40:05] jready: has joined #ruby
[20:44:39] Lytol: has joined #ruby
[20:46:23] denkweise: has joined #ruby
[20:47:15] dipnlik: has joined #ruby
[20:53:33] orbyt_: has joined #ruby
[20:59:55] oleo: has joined #ruby
[21:06:02] robertothais: has joined #ruby
[21:06:58] tomphp: has joined #ruby
[21:10:59] BTRE: has joined #ruby
[21:14:53] ramfjord: has joined #ruby
[21:17:46] Azure: has joined #ruby
[21:20:52] kapil___: has joined #ruby
[21:27:28] dviola: has joined #ruby
[21:33:17] garyserj: has joined #ruby
[21:34:44] oleo: has joined #ruby
[21:40:40] GodFather: has joined #ruby
[21:41:46] rkazak: has joined #ruby
[21:48:48] robertothais: has joined #ruby
[21:52:10] tdy: has joined #ruby
[21:52:58] orbyt_: has joined #ruby
[21:53:32] weaksauce: has joined #ruby
[21:58:23] kmurphy4_: has joined #ruby
[21:58:38] tomphp: has joined #ruby
[22:06:56] joro_: has joined #ruby
[22:12:37] jnollette: has joined #ruby
[22:19:06] dr3wo: has joined #ruby
[22:20:50] roamingdog: has joined #ruby
[22:24:57] ellcs: has joined #ruby
[22:40:24] tdy: has joined #ruby
[22:40:57] rivalomega: has joined #ruby
[22:43:15] d^sh: has joined #ruby
[22:44:16] dcunit3d: has joined #ruby
[22:48:45] Azure: has joined #ruby
[22:52:07] roamingdog: has joined #ruby
[23:05:02] cagomez: has joined #ruby
[23:15:37] ramfjord: has joined #ruby
[23:31:55] tehgeek72: has joined #ruby
[23:35:22] s3nd1v0g1us: has joined #ruby
[23:35:57] s3nd1v0g1us: has joined #ruby
[23:36:32] s3nd1v0g1us: has joined #ruby
[23:36:48] nicesignal: has joined #ruby
[23:37:07] s3nd1v0g1us: has joined #ruby
[23:42:46] jready: has joined #ruby
[23:49:36] ur5us: has joined #ruby