#ruby - 11 December 2018
« Back 1 day Forward 1 day »
[03:15:55] Ookma-Kyi: Just started a rails app, how do I make it apply a .html.erb file instead of the starter text?
[03:16:40] ruby[bot]: Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
[04:41:36] havenwood: mruby 2.0 is out! https://mruby.org/releases/2018/12/11/mruby-2.0.0-released.html
[05:04:32] havenwood: So mruby ended up getting #then, #union and a #to_h block before they landed in Ruby 2.6. :)
[05:41:27] elcontrastador: how do i use nokogiri builder when i have elements that use hyphens and not underscores?
[06:02:54] beef_erikson: need to figure out how to script this irc client. autojoin is a thing that needs to happen lol
[09:06:19] yasserhussain111: I wanted your suggestion on what editor I should use to study ruby's source code
[09:08:09] beef_erikson: personally I've been using VS Code for the last year or so for any language
[09:48:02] yasserhussain111: Are there any other resources which can help me get upto speed with ruby source code?
[09:49:10] beef_erikson: I'm not a great person to ask. I'm very new to the language and kinda 'just passing through'. Reading a book that is briefly covering ruby
[09:50:47] beef_erikson: I've been idling here in case I run into questions. pretty straightforward language. I'd guess there are probably good tutorials out there, it doesn't seem complicated in comparison to others I've worked in
[09:51:52] yasserhussain111: Yeah I understand the language. I was just wondering if I could get help with its implementation details.
[13:31:14] ruby[bot]: Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
[15:56:29] Ookma-Kyi: i have a server running on 0.0.0.0:3000 but i can't access it from my domain help!
[16:00:25] Ookma-Kyi: thing is it's a vm with a public ip, how do i get ruby/rails to use my public ip instead?
[16:04:38] mnemon: Ookma-Kyi: iptables -L, unless empty you prolly need to add iptables rule for port 3000
[18:40:20] nakuku: Hello guys! Could anyone give me some advice concerning unit testing? I prepared a piece of code to look and questions are included. I don't even know what question should i ask, i just have some code smell and need some advice. Basically, how do i unit test such code? And i don't ask about 'how to use expect etc.', i mean more general principles.
[18:40:40] ruby[bot]: nakuku: 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
[19:00:02] havenwood: nakuku: No need for #tap here and use #present? instead of #presence when you're not using the return value, so just `unless removed_team.present?`: https://gist.github.com/naku-i386/7b675cced14a299e1f013d3dbe6d3f45#file-sdad-rb-L8-L11
[19:01:14] havenwood: nakuku: It's ever-so-slightly nicer to use `Time.current` instead of `Time.zone.now`.
[19:02:04] havenwood: nakuku: There are some internal discrepancies in your code, but I guess you pointed out it's psuedo-code.
[19:05:08] havenwood: nakuku: You might want to read through some open source specs that test similar things, for ideas and patterns. For example, Discourse's services specs: https://github.com/discourse/discourse/tree/master/spec/services
[19:07:25] nakuku: Oh, you're so right regarding presence. Will change to Time.current. Thank you very much, i needed some insight because sometimes i just get stuck thinking too much.
[19:10:34] EugenMayer: Is there a way with Dir.glob to e.g. find all "Grunfile.js" in all subfolders, but not in all subfolders which have node_modules in the path?
[19:12:39] EugenMayer: i could probably use **/Gruntfile.js and then negate **/node_modules/**/Gruntfile.js from this set
[19:16:30] havenwood: eugenmayer: Find has the benefit of not looking in all lthe node_modulles/ dirs, if it matters.
[19:32:59] havenwood: eugenmayer: Here's a little abstraction on top of Find.find for your case: https://gist.github.com/havenwood/f34a4b2b9f1a578b89d89f657fb7668b
[19:56:28] EugenMayer: esp the skipping part is a huge plus, so that on finding the first node_modules, we do not look deeper - thats just a winner
[21:45:32] smhuber: Would anyone mind sharing some feedback on the proposed syntax in this proof of concept? https://github.com/LendingHome/pipe_operator#-pipe_operator
[21:45:38] smhuber: It looks pretty similar to the syntax used in Matz' other language https://github.com/matz/streem
[21:46:06] smhuber: Is this something that you could imagine using regularly? Or too confusing? I would love to hear other thoughts to see if its worth exploring further, thank you!
[22:38:38] dmitch: What is the normal means for building a Ruby CLI app? Do most people just build a gem? The only reason I question it is that this gem would not be a dependency for any other project. It truly would be standalone.
[22:40:30] dmitch: True, there are other great options. This is a special case where some already-written code needs to get moved out of an existing project.
[22:42:10] dmitch: And since this is standalone, then would this be a case where the Gemfile.lock *should* be checked in? I'd assume so. Normally that's not advised so-as to prevent apps from having dependency versions locked down, but in this case it feels like dependencies should be locked down.
[22:49:10] dmitch: Let me restate that second thought: Normally if you're building a gem, you'd specify the dependencies in the gemspec file and *not* check in the Gemfile.lock file. You'd have your versioning restrictions in the gemspec only so as to allow another app using your gem the ability to have some flexibility around the exact transitive dependency versions. In my particular case, there are no consumers of this gem in the form of a dependency; it's strictly a CLI. And
[22:49:11] dmitch: since that's the case and it's basically treated like a real app, I'd want to versioning locked down to ensure all users of the CLI gem have the exact same dependencies.
[23:09:43] Radar: dmitch: how do the people running this CLI run the CLI? Do they clone down the repo and then run `bin/<your app>`?
[23:21:29] ruby[bot]: +bbb $a:nine_milli$#ruby-banned nine_milli!*@*$#ruby-banned *!*@c-76-28-115-114.hsd1.ct.comcast.net$#ruby-banned
[23:21:29] ruby[bot]: ruby[bot] kicked nine_milli: offense, see http://ruby-community.com/pages/user_rules
[23:49:30] rubydoc: I'm terribly sorry, I could not evaluate your code because of an error: StandardError:Couldn't match lang/mode
[23:49:46] rubydoc: I'm terribly sorry, I could not evaluate your code because of an error: StandardError:Couldn't match lang/mode