#ruby - 02 July 2017
« Back 1 day Forward 1 day »
[03:09:50] rubyconfused: the ruby interpreter gives me this: syntax error, unexpected ')', expecting => (SyntaxError)
[03:10:35] rubyconfused: running it through rubocop gives the following: E: unexpected token tRPAREN (Using Ruby 2.1 parser; configure using `TargetRubyVersion` parameter, under `AllCops`)
[03:19:50] mkaito: I'm not a fan of putting that kind of syntax on an introduction of any kind, but shrine does it.
[03:21:34] mkaito: after putting the hash before the Shrine.storages call in the else branch and splatting the hash in the other branch, rubocop does no longer scream at me for that gist.
[03:22:20] rubyconfused: I did that and I am not getting this: W: Useless assignment to variable - `s3_options`.
[03:25:07] mkaito: that said, there's no point in making a separate hash if you only use those options once
[03:25:16] rubyconfused: a bit of context: I am debugging this because dokku is unable to build my project due to line 21 getting nil hash errors
[03:26:23] mkaito: texasmynsted: his problem is clearly ruby... even if he's using it for rails. as in, he doesn't know that he needs to declare a variable before using it :P
[03:26:33] texasmynsted: what server should I use in order to take fully advantage of multi-threading of JRuby? Can this be the same as the server used for C-Ruby?
[03:26:56] texasmynsted: irrc passenger would work this way but one needed to upgrade to enterprise to get full multi-threading support.
[03:34:28] rubyconfused: mkaito: attempted to push to server, getting these errors: syntax error, unexpected ')', expecting => on lines 13 and 24
[10:00:59] hnanon_: I have a string that I want to sequentially append numbers to. Is a regex the simplest way? For example:
[10:01:26] hnanon_: where I look for a "-" in the atring, if it exists, extract the number, convert it to an integer, add one to it, convert it to a string, then append it?
[10:09:12] muelleme_: depending on how exactly your string looks like, that might already do the trick
[12:52:58] lxsameer: hey folk, is there any one who used webpacker gem before ? I like to know about your experience with it
[14:00:36] rapha: nhttps://www.computerworld.com.au/article/621028/ruby-decline-popularity-may-permanent/ o_O
[14:00:41] rapha: Sorry, https://www.computerworld.com.au/article/621028/ruby-decline-popularity-may-permanent/
[14:01:06] rapha: But hey, perhaps if the ruby-hipster-culture dies, then perhaps that'll do the community some good.
[14:03:19] havenwood: rapha: Computerworld runs that story for every top ten language once a month. Click bait.
[19:14:06] aruns: Hey guys, I'm looking into using Ruby as a templating language for a simple HTML site I'm working on, was wondering if you guys had any recommendations for libraries I could use to embed my Ruby code in HTML templates without using Rails.
[19:17:43] Papierkorb: aruns: Webrick is dog slow, you can use thin or puma instead. Also, there are other much smaller web frameworks than Rails, `sinatra` is popular, but I also want to recommend `roda` for that task. As templating language, sure there is erb, but I like `haml` much more.
[19:17:58] apeiros: aruns: templating is only the part which converts text into other text, interpolating some variables and potentially control structures
[19:18:20] apeiros: aruns: the thing you seem to be looking for is how to run ruby via a webserver, that goes way beyond templating.
[19:19:23] apeiros: and <any ruby backend> is often sinatra or rails. you can build a plain rack app too, though
[19:19:55] apeiros: as for the "templating engine" option (which would be part of the <any backend>): slim, haml and erb are common choices
[19:31:48] aruns: Papierkorb: Yeah I wrote some URL rewrites in NGINX for a client site and found its syntax to be much cleaner than Apache's
[19:33:00] Papierkorb: aruns: Not only that, it's also much much faster. to me it seems that apache has only limited use-cases left where it's better than other solutions, for other use-cases, go with NGINX
[19:47:17] learningruby: Question: The book “The Ruby Programming Language” says: ‘Chapter 4 covers primary expressions in Ruby—literals, variable references, method invocations, and assignments”. But how is a method invocation a primary expression? It seems to me that it's composed of several values/components: object, method, arguments. Can anyone explain?
[20:16:53] learningruby: ineb: I don't think that, the book “The Ruby Programming Language” (by Matz and David Flanagan) seems to say so in the quote I gave above.
[20:27:28] learningruby: ineb: The way the book defines primary expression is like an ultimate expression, that don't have subexpressions. Maybe is there some method invocations that are like that? I don't know, but it doesn't seem so when I think about it. Or maybe that was a little mistake in the writing of the book. That's what I'm trying to figure out.
[20:29:04] learningruby: ineb: the book seems to be quite precise and well written.. and it had three authors collaborating on it, so I find unlikely to be a mistake.
[20:34:22] ineb: i see your point. method invocations theoretically could be composed by primary expressions you mentioned, yet there is no operator to do so and i think the book therefore is tagging it as primary expression
[20:52:55] learningruby: ineb: mmm I see. But the book doesn't seem to differentiate primary expressions from compound expressions based on operators. For example, see this quote from the book: “It is worth noting that many literals, such as numbers, are primary expressions—the simplest possible expressions not composed of simpler expressions. Other literals, such as array
[20:52:55] learningruby: and hash literals and double-quoted strings that use interpolation, include subexpressions and are therefore not primary expressions.” -> So, here as you see the book defines expressions as primary or compound based on whether it has sub expressions.
[20:54:20] learningruby: But then later it calls method invocations as being primary expressions, and it doesn't elaborate on it. So I'm confused.
[20:58:57] ineb: yes, but maybe my argument holds. for example string interpolations are no primary expression because they can be constructed with operators. 'i mean ' + ' like this.'. this holds true for hashes and arrays aswell. however, when it comes to method invocations, i can think of no way to do it with any operator
[21:59:39] learningruby: ineb: ooh I see. I didn't know that you could write hashes and arrays with operators, interesting.