Activity Graph

Page 1 of 2 | Next »


[00:56:17] JJonah: *.net *.split


[13:17:34] JJonah: Read error: Connection reset by peer
[13:17:54] JJonah: has joined #RubyOnRails
[13:18:00] JJonah: has joined #ruby


[19:15:01] JJonah: Ping timeout: 276 seconds
[19:40:31] JJonah: has joined #RubyOnRails
[19:40:37] JJonah: has joined #ruby


[22:08:46] JJonah: Ping timeout: 250 seconds


[01:20:55] JJonah: Read error: Connection reset by peer
[01:50:42] JJonah: has joined #RubyOnRails
[01:50:48] JJonah: has joined #ruby
[03:25:11] JJonah: Ping timeout: 255 seconds


[20:17:51] JJonah: We have a library file that is getting loaded twice. I believe Rails auto-loading is causing this. The errors vanishes if I put an `unless defined? ConstantDefinedInTheFile` around the contents of the file, but this is obviously a horrible solution. Does Rails provide any mechanism natively to ensure that the auto-loading won't reload the same file? If not, what other options do we have?
[20:41:18] JJonah: Looks like setting cache_classes=true in dev fixes it...


[06:34:19] JJonah: Ping timeout: 258 seconds
[07:00:00] JJonah: has joined #RubyOnRails
[07:00:06] JJonah: has joined #ruby


[16:49:49] JJonah: *.net *.split


[18:20:55] JJonah: Read error: Connection reset by peer
[18:21:28] JJonah: has joined #RubyOnRails
[18:21:30] JJonah: has joined #ruby


[04:33:08] JJonah: Ping timeout: 268 seconds
[04:36:05] JJonah: has joined #RubyOnRails
[04:36:11] JJonah: has joined #ruby
[10:59:14] JJonah: Ping timeout: 252 seconds
[11:00:49] JJonah: has joined #RubyOnRails
[11:00:55] JJonah: has joined #ruby


[22:52:38] JJonah: *.net *.split


[16:38:52] JJonah: has joined #RubyOnRails
[16:43:13] JJonah: Is it possible to configure rails so that every variable output in any view is automatically escaped to be safe against XSS attacks? essentially the equivalent of manually calling `sanitize` on every string you display in a view?
[17:32:40] JJonah: so it looks like rails has been sanitizing all view output by default since rails 3. yet in our applicaton we were able to perform a XSS attack by outputing `<script>alert('test')</script>` in a haml view. we did not use html_safe. what would cause it _not_ to be sanitized? we're using rails 5.1.5.


[02:17:47] JJonah: is there any Array builtin that _disallows_ negative indexes? `[]` and `fetch` both interpret negative values as counting from the right...


[02:17:15] JJonah: The docs for Enumerator::Lazy#flat_map offer this example: `["foo", "bar"].lazy.flat_map {|i| i.each_char.lazy}.force` but I can't find the method `force` documented anywhere in Lazy or elsewhere: https://ruby-doc.org/core-2.5.3/Enumerator/Lazy.html. What am I missing?


[00:29:43] JJonah: apeiros: yes, i was wondering if you could make the Enumerator work without iteration. It looks like it calls next internally as `'JJonah'.each_char.cycle.lazy.drop(42_000_000).first` pauses a couple seconds before returning.
[00:30:37] JJonah: yeah, i figured. just wanted to make sure.


[22:11:14] JJonah: is it possible to use `cycle` on an array and then extract the nth element using `[]` (or another method) without first converting the Enumerator to an array? Said another way, can you get the nth element of an Enumerator without calling `next` n times?


[00:03:24] JJonah: Nice trick here: `meta_klass = class << self; self end`. I've been doing a lot of meta-programming lately but never thought to do that. Thanks for sharing.
[00:10:10] JJonah: that sounds like an un-rubyish solutino
[00:15:24] JJonah: cthu: if the file large enough to load into memory, do one pass where you filter out the junk, then each_slice to get your C,A,L lines as chunks, then map to make the objects.
[00:15:37] JJonah: small enough to load into memory*


[14:20:55] JJonah: Is there any way to refer to the entire argument hash on a method with named parameters? That is, to avoid the verbose repetition you see on line 14 here: https://hastebin.com/ejufuregaq.rb
[23:48:40] JJonah: Reposting this because hastebin was down earlier: Is there any way to refer to the entire argument hash on a method with named parameters? That is, to avoid the verbose repetition you see on line 14 here: https://hastebin.com/ogokidoduz.rb
[23:54:09] JJonah: baweaver: right, thanks for the confirmation though.
[23:55:33] JJonah: me too. really seems like this should be built in. ofc the other way is take a hash, then validate the hash to enforce the args inside the method. but that feels worse than the repetition too...


[05:06:07] JJonah: i'm writing a module that adds methods to a class when that class extends it. it will add private methods as well, purely to make the code more readable, but i don't want those private methods to conflict with any private methods a user might write. is there a convention for doing this? eg, prepending or appending `_` or `__` to the private method names?


[20:32:47] JJonah: automatically for every method. That is, every method would get wrapped by a memoizer. But I can't find a good meta-programming technique to accomplish this (other than creating a class method like `def_memoized` that I'd use every time instead of `def` -- a solution I'm not crazy about). Any ideas?
[20:32:47] JJonah: Consider an immutable value object with lazy, memoized methods for derived attributes: https://eval.in/1053602. It's tedious to create the memoizations like `@some_attr ||= ...` for every single method, especially when I know beforehand (since the object is immutable) that I want *every* method to work like that. Ideally I could just `extend ValueObject` as the first line under the class definition, and this would happen
[21:09:50] JJonah: apeiros: how would that work syntactically? (ie, `memoized def foo`) Googling "prefixed ruby method" isn't turning up anything. What it suggests is exactly what I want (meaning I want to treat an ordinary `def` defined method as a first-class object, and then either wrap it or alter it to provide the memoization functionality. But I thought ruby wasn't capable of this...
[21:15:31] JJonah: apeiros: TIL `def` returns a symbol... Ok what you did makes sense. I guess the part that screwed with me is I want to be able to address the method as an object (like a `Proc`ish) at the class level, but the concepts of `UnboundMethod` only makes sense in ruby at the instance level. Which (related to my question last night) seems like an arbitrary, unnecessary restriction.
[21:23:31] JJonah: apeiros: sorry, that was confusing. I meant that you can't (or I can't figure out how to :) to take an UnboundMethod, alter it (eg, by wrapping it with a memoizer) and then "re-attach" at the class level to its original class. This kind of thing, eg, would be trivial in JS.
[21:25:11] JJonah: (other than using `class_eval` as you did, ofc). But that requires manipulation via strings.
[21:25:39] JJonah: apeiros: in JS you can just wrap it. and then put it back on the object
[21:26:40] JJonah: apeiros: So can you do what you did without "eval", but using actual Proc or UnboundMethod objects? That's essentially what I'm asking (and saying is easy in JS)
[21:30:30] JJonah: apeiros: i know about the gems. i'm trying to understand it myself and understand the options. also i'm not crazy about the gem interfaces i've looked at.
[21:31:12] JJonah: lupine: "by disdaining classes and using hashes everywhere" . I have no desire to do that :)
[21:32:55] JJonah: "so it's not surprising that some things are different"... my issue isn't that "thing are different". it's that i wasn't able to do something i thought i should be able to do. but apeiros last replies are basically the answer i was looking for.
[21:33:39] JJonah: "indiscriminately memoize all methods" not if you're in the context of an immutable value object which was the jumping off point of the discussion.
[21:34:08] JJonah: "immutable objects - though memoization basically breaks that" -- it does not.
[21:34:29] JJonah: only in a technical sense, not in a conceptual sense
[21:34:59] JJonah: because you are guaranteed that a pure function on immutable params will always return the same value
[21:35:28] JJonah: the object is still immutable in every meaningful way. the "memoizatoin" mutation is purely a caching strategy
[21:36:53] JJonah: lemur: i don't want you mean by that. but immutable value objects are very useful in ruby. i don't see any pedantry about them
[21:37:20] JJonah: "referential purity, sure. If the outside caller doesn't know you're doing something impure it matters very little." exactly
[21:38:04] JJonah: apeiros: that breaks lazy evaluation which is a very good thing and what i'm after here.
[21:39:29] JJonah: apeiros: how do you get lazy evaluation out of truly frozen object?
[21:39:49] JJonah: (lazy evaluation and caching i should say)
[21:40:20] JJonah: lemur: "relish in the fact that it still follows the contract of idempotency" i want to relish
[21:42:29] JJonah: apeiros: I want the object to cache its own values. The pattern of my original paste is exactly what I want, I just want to avoid the repeated `||=` boilerplate.
[21:43:56] JJonah: apeiros: sure, but that's just an implementation detail. i fail to see how that's fundamentally different from the pattern i posted.
[21:44:50] JJonah: "for that requirement. seems rather arbitrary." -- which requirement. i meant this pattern: https://eval.in/1053602
[21:45:47] JJonah: apeiros: yes, i think we're crossing wires. if the internal hash is doing it, it's still "the object caching its own values"
[21:46:06] JJonah: the only POV we're considering is the object's contract from the outside
[21:46:42] JJonah: apeiros: external to the object itself? that would be bad imo. an internal hash, that's fine.
[21:47:30] JJonah: apeiros: we're just using the word differently
[21:47:55] JJonah: i mean the client of the object should not have to deal with the object AND a 2nd object that does the caching
[21:48:28] JJonah: apeiros: i am like 95% sure we're agreeing
[21:49:33] JJonah: lupine: yes, that's a good point. you can get around that if need be though.
[21:50:36] JJonah: lupine: yours being the method_missing version?
[21:50:55] JJonah: and yes, i agree that is an implementation detail
[21:51:39] JJonah: to me the question of `||=` vs a private hash is of little import.
[21:51:57] JJonah: lupine: sure
[21:55:55] JJonah: lupine: the only thing i don't like about the method_missing snippet you posted is that I have to create my object and then wrap it. I can't just issue the directive at the class level. Or have I misunderstood?
[22:03:25] JJonah: lemur: do you use your Mf gem often in your own work? I found it a few weeks after write a similar gem (https://github.com/jonahx/pretty_ruby) and thought it was quite clever.
[22:03:31] JJonah: baweaver: ^^
[22:07:02] JJonah: baweaver: i want to alias it to X though so i can do `map {&X + 5}` etc... :)
[22:07:32] JJonah: bomb: the language is intended to be fun to write and pretty to read.
[22:11:27] JJonah: baweaver: nice.
[22:13:19] JJonah: bomb: that's a hard question to answer. the short is: it's a nice language, but not perfect.
[22:18:32] JJonah: baweaver: "They're hell on inheritance chains though"... just scrolled up to copy something and noticed this. Don't you mean "inheritcance chains are hell in themselves"?
[22:22:05] JJonah: bomb: what do you program in now?
[22:26:35] JJonah: bomb: i personally think ruby is more fun than both of those languages, especially java. though tbh it's not _that_ different from python.
[22:28:39] JJonah: bomb: haven't use it much myself, but i think it's fairly mature.


[06:45:17] JJonah: what is the reason's for the "you can only bind to a superclass" restriction on UnboundMethods. typically ruby gives you the freedom to shoot yourself in the foot, so if i know an unbound method makes sense in another class from which it does not inherit, why can't i bind to it? is there a technical reason?


[03:43:26] JJonah: is it possible to dynamically create a method (with `define_method` or any other way) whose arguments have default values?
[03:58:06] JJonah: woodruffw: thanks. i actually have a hash, and i want the keys of the hash to be the named arguments and its values to be their defaults. i can't figure out how to adjust your example for this case...
[03:58:20] JJonah: (the hash is dynamic)
[04:10:13] JJonah: woodruffw: I actually want something more like this: https://hastebin.com/efexuwodil.ruby
[04:20:49] JJonah: woodruffw: thanks. i'm gonna see if i can hack it with eval.
[04:25:54] JJonah: woodruffw: thanks, got it working with class_eval


[20:42:49] JJonah: is it possible (somehow) to get a ruby thread to start before the method which kicks it off exits? ie, i am trying to avoid the hanging, without output, I get here: https://eval.in/1052858
[20:46:53] JJonah: ramfjord: it will print, but only after the sleep finishes. i want the thread to start when it actually starts, and i was assuming the sleep affects only the main thread...
[20:48:54] JJonah: ramfjord: ah! you're right. if i raise an exception it goes immediately. ty
[20:58:18] JJonah: havenwood: ty, good to know


[22:12:28] JJonah: has joined #ruby
[22:12:43] JJonah: Say I require a gem in many files, and the gem exposes a module named `X` after I include it. I would prefer to use `Y` everywhere in my code instead of `X`. Of course I could just write `Y = X` after ever require -- but what is a better way to accomplish this?
[22:15:12] JJonah: elomatreb, yes, i should have specified i want to know if there are any solutions besides that.
[22:15:52] JJonah: elomatreb: thanks, that's what i thought


[16:24:55] JJonah: *.net *.split


[21:15:15] JJonah: any suggestions for hosting private gems? (either SaaS or something i'd run on my own server). I want something easy, with good discoverability (ability to search gems by keyword).
[21:22:21] JJonah: havenwood: Is geminabox still well maintained? "Latest commit bf71f9b on Jun 15"
[21:23:17] JJonah: Also, does it come with any kind of built in search?
[21:31:28] JJonah: this_dude: try something like this instead and avoid loops: http://dpaste.com/07NJ4WP
[21:33:16] JJonah: this_dude: it's Xing out every char but the last 4
[21:33:32] JJonah: apeiros: which edge case are you thinking?
[21:34:14] JJonah: apeiros: if it's a cc number though, should be fine
[21:35:27] JJonah: apeiros: yeah, i was assuming that was the case
[21:36:49] JJonah: apeiros: i suppose it depends on context. but if this were production code i'd want to see the method that does what i did split out from the validation one way or another.
[21:38:11] JJonah: this_dude: try breaking down the different pieces. it's fairly standard ruby. we're just repeating an X for "4 less than as long as the string is". Then I'm using [] to chop off the last 4 chars of the string.
[21:39:16] JJonah: ooohh that regex solution is nice. that's better than mine.
[21:42:35] JJonah: and since the final 4 characters don't have "4 more characters to their right" they don't match, and hence they don't get changed.


[15:42:39] JJonah: I can't find anything in ruby style guide about line breaking conventions. eg: https://eval.in/1044640. Do any standards exist around this?
[15:52:00] JJonah: havenwood: ty! i knew it was in there somewhere...
[15:58:01] JJonah: Zarthus: Agreed, but I like the 80 cutoff. I know the number evolved out of old terminal days, but at some point lines get too long, and it's _around_ there... maybe it's 90, 100... whatever. But I think there value to picking some number when you're on a team, and sticking to it.
[15:58:58] JJonah: 120 feels too long to me, but eh, not a hill I want to die on.
[16:19:20] JJonah: Zarthus: I agree with your code smell point, but that's a bit like saying
[16:21:12] JJonah: a bit like saying getting beat with a stick when your code smells makes it obvious :)
[16:22:21] JJonah: also, there is legitimate, non-smelly use of nested indentation: nested modules for namespacing. with 8 space tabs that will screw you.
[16:26:18] JJonah: baweaver: that's why style should be enforced at the tooling level. making human beings into parsers is just a waste...


[22:45:54] JJonah: Ie, `OpenSSL::ASN1::Sequence(@extensions)` works. Relevant docs: https://ruby-doc.org/stdlib-2.4.0/libdoc/openssl/rdoc/OpenSSL/ASN1/Constructive.html
[22:45:54] JJonah: Why are you allowed to create new ASN1::Sequences and Sets without using new?
[23:00:55] JJonah: havenwood: ah! is that a common pattern?
[23:01:28] JJonah: is it considered good practice?


[18:20:00] JJonah: I want to decorate an existing class to add a new class method. I can do this, but I don't like having to create the intermediate class `BetterClass__`: https://eval.in/1042206. Is there a better way to do this? In general, is there a better way to upgrade existing classes via decorators to add new methods. It's not necessarily relevant, but in this particular case, I want to add a declarative, hash-based constructor to
[18:20:03] JJonah: `OpenSSL::X509::Certificate`.


[17:14:29] JJonah: Gemfile to point back to the actual gem (rather than the local copy), test again, and finally publish the changes to the rails project. this feels inefficient and because of that discourages the team from using gems even they are appropriate. is there a better solution for developing projects with gem deps?
[17:14:29] JJonah: we use gems to share domain code across different projects. sometimes i need to make an update to a project, which also requires a gem update. when doing this, i need to change both the gem and, say, a rails project simultaneously. so i'll clone the gem into the `lib` dir, specify that local path temporarily in the rails project Gemfile, and make changes until my tests pass. Then I'll publish my gem changes, change the rails
[17:55:03] JJonah: apeiros_: thanks. your preferred solution seems like an improvement. In the article they set the Gemfile to point to the github repo: `gem "tacokit", github: "rossta/tacokit", branch: "master"`. Would you typically change this back to just `gem 'tacokit'` after republishing the gem? Or is a valid approach to just leave the gem hosted on gh and not bother?
[18:12:11] JJonah: apeiros_: so for "internal" gems you'd recommend gh?
[18:14:53] JJonah: apeiros_: how does "ourcompany" get resolved?
[18:19:36] JJonah: apeiros: thanks


[19:28:35] JJonah: i'm creating refinements that upgrade many of the Enumerable methods in the same way: https://eval.in/1040378. is there a good away to avoid duplication here? using metapromming (or by any other method)?
[19:33:11] JJonah: apeiros: i did indeed path Array
[19:33:26] JJonah: it works well, i have lots of tests
[19:34:20] JJonah: apeiros: yeah, that's fair enough, but this is more experimental / for fun. also, it's fully backwards compatible with normal calling conventions.
[19:36:36] JJonah: apeiros: but eg what i'm doing allows stuff `map(:join, '-')`. it gets much uglier if i force the proc conversion in userland: `map(&[:join, '-'])`
[19:38:25] JJonah: cool. in any case, the wisdom of the refinement is valid but separate debate. my original question about how to avoid code duplication in situtations like this still stands.
[19:40:04] JJonah: apeiros: ok cool, i'll continue as i am
[22:02:27] JJonah: most of the Enumerable methods have a version that returns an Enumerator when no block is given. Eg, https://eval.in/1040390. What is the use case for this? I'm having trouble imagining a situation where I'd use the behavior...


[00:07:19] JJonah: *.net *.split
[00:15:34] JJonah: has joined #ruby
[21:46:10] JJonah: say i have a gem which offers refinements to Array, among other classes. i'd like the ability to do `using MyGem`, which would include all the available refinements, while also offering the ability to include only the specific refinements a client needs. something like `using MyGem::Array`. is there a canonical pattern to achieve this?
[21:58:31] JJonah: konsolebox: perhaps a clearer version of the same question. is there a canonical pattern that allows client code to use a group of related refinements either individually, or all together? lmk if that's still not clear...
[22:01:17] JJonah: darix: not a bad idea... thx
[22:19:03] JJonah: apeiros: ah true, i forgot that was old school monkey patching


[05:29:51] JJonah: Ping timeout: 276 seconds
[05:31:07] JJonah: has joined #ruby


[05:16:30] JJonah: *.net *.split
[05:35:18] JJonah: has joined #ruby
[14:55:52] JJonah: has joined #RubyOnRails


[03:05:30] JJonah: i'm trying to determine an array's levels of nesting. the best i've got so far is: https://eval.in/1036351. is there a terser, preferably more functional, alternative?
[03:19:32] JJonah: elomatreb: thanks, i like that a bit better
[03:38:13] JJonah: havenwood: nice
[20:56:49] JJonah: if you define a lambda within a method, as a helper function relevant only to that method, will the interpreter be smart enough to optimize the lambda so that it's only created once and re-used, or will it be created, thrown away, and garbage collected every time the method is invoked?
[20:59:43] JJonah: Alec: ah, then maybe. i'd be curious for the answer in both cases, if its different
[21:00:38] JJonah: Alec: ty, could you also show me how you are testing it? i wasn't sure how to do it myself and would like to know
[21:11:17] JJonah: apeiros: yeah, i figured this was basic enough that i actually wanted to know how it worked under the hood though.
[21:15:10] JJonah: apeiros: good example, although technically wouldn't that prove only that it recreates it "when it needs to". ie, it might only be recreating it because it's smart enough to know the lambda isn't pure and in this case the "natural" behavior would be broken if it kept it around. but in cases where it there were no ill effects it could...
[21:18:27] JJonah: related question: ignoring the silliness of this example, i was interested in the scoping rules that prevent the following from working: `def fact(n); step = ->(m) { m == 0 ? 1 : m * step(m - 1) }; step.(n) end`. I mean, lambda's have access to local vars, the step var is in local scope...
[21:22:24] JJonah: "I'd expect it to be the same." You're right, it is.
[21:23:05] JJonah: apeiros: doh! ty
[21:27:16] JJonah: eat the verbosity
[21:27:16] JJonah: so the bottom line of all this is: if you have a helper function for one of your methods, you're options are 1. create an inner lambda and eat the inefficiency of it being recreated each call 2. make a private helper method relevant and eat the messiness of having a relevant-to-one-method-only helper method on your class 3. make an object to encapsulate the original method and make the helper method private on _that_ object, and
[21:30:35] JJonah: apeiros: agreed, least of all evils
[21:31:16] JJonah: at least in most cases. if the complexity is high enough 3. becomes worth it.
[21:45:00] JJonah: headius: thx for the info.


[02:57:14] JJonah: I'm using refine to refine the Enumerable module with an altered version of map. When I use with `using MyModule`, the changes to map are not available. If I put the exact same refinement on the Array class, it works. You are supposed to be able to refine modules, though (https://github.com/ruby/ruby/blob/96db72ce38b27799dd8e80ca00696e41234db6ba/test/ruby/test_refinement.rb#L379). Why would it not be working?
[03:08:57] JJonah: To clarify the problem, take a look at this: https://eval.in/1035718
[03:11:38] JJonah: havenwood: oh i just assumed that Array mixed in Enumerable to get map -- is that not the case?
[03:14:01] JJonah: havenwood: gotcha, makes sense. but now i'm curious why Array needs a special implementation of map?
[03:14:53] JJonah: havenwood: ok tyvm
[20:57:38] JJonah: is there a way to introspect a ruby method or proc to figure out if it can take a block argument?
[21:02:12] JJonah: returns an empty array, so I wouldn't know that map took a block
[21:02:12] JJonah: p t.parameters #=> []
[21:02:12] JJonah: t = Array.instance_method(:map)
[21:02:12] JJonah: havenwood: hi! so i may be misunderstanding your suggestions, but eg this:
[21:06:23] JJonah: havenwood: ok, so there's simply no way to introspect that?
[21:09:25] JJonah: havenwood: ty


[14:47:38] JJonah: The "or" method `:|` exists on TrueClass and FalseClass, but the short circuit `||` operator does not? Why this asymmetry? And is the `||` operator an exception to ruby's "everything is an object" metaphor? Is it instead just a baked in bit of global syntax? If not, what is it?


[03:52:27] JJonah: Ping timeout: 276 seconds
[05:29:11] JJonah: has joined #RubyOnRails
[05:29:17] JJonah: has joined #ruby
[05:57:54] JJonah: Ping timeout: 276 seconds
[06:21:57] JJonah: has joined #ruby
[06:22:01] JJonah: has joined #ruby
[06:22:01] JJonah: Changing host


[03:44:47] JJonah: *.net *.split
[07:47:37] JJonah: has joined #ruby
[07:47:38] JJonah: has joined #RubyOnRails


[02:47:15] JJonah: *.net *.split
[02:47:48] JJonah: has joined #RubyOnRails
[02:48:07] JJonah: has joined #ruby


[01:00:11] JJonah: are there popular gems that are implemented with refinements and enhance the array class or enumerable module with additional utility methods like `scan` (ie, all partial sequences)?
[21:39:16] JJonah: anyone know why the Hash method `transform_values` was not named `map_values`, which is both shorter and more consistent?


[14:44:12] JJonah: NoMethodError: undefined method `parse' for ActiveSupport::Duration:Class
[14:44:12] JJonah: irb(main):029:0> ActiveSupport::Duration.parse('PT10S')
[14:44:12] JJonah: According to the docs here (http://api.rubyonrails.org/classes/ActiveSupport/Duration.html#method-c-parse), my code below should work. What am I doing wrong:
[14:59:30] JJonah: nzst: thank you. i'll check my version then. must be something on my end.
[15:01:31] JJonah: nzst: ah, looks like this project is actually rails 4. it must be a new feature...


[17:33:43] JJonah: has joined #ruby
[17:33:43] JJonah: has joined #RubyOnRails


[18:28:37] JJonah: anyone know of a good ruby gem to automatically extract a plain text version of an article from an html blog or news site? i'm looking for something higher-level than nokogiri specifically optimized for this task, basically a ruby equivalent of the python module "newspaper" (https://github.com/codelucas/newspaper/)


[04:59:39] JJonah: For a method `test` with only keyword args, `p Test.method(:test).parameters` returns `[[:rest]]`. I'd like to get the actual names of the keywords. Is it possible?
[05:04:02] JJonah: havenwood: 2.4.2. however, `test` is an instance method
[05:05:43] JJonah: havenwood: weird. ok, something else must be going on. thanks.
[05:11:13] JJonah: havenwood: ah, turns out i'd been mucking around and created my own `self.new` method for an unrelated experiment, and had forgotten that i'd done so. when i removed that it worked as it should. just dumb operator error.
[05:42:17] JJonah: I have a file `lib/authentication/strategy.rb` containing the class `Authentication::Strategy` and I in application.rb I have `config.autoload_paths << Rails.root.join('lib')`. I am getting the error `Authentication is not a module` from a controller using the `Authentication::Strategy` class. I thought autoloading should make it available. What am I missing?
[05:51:55] JJonah: adding require statements to the top of controller fixes the problem. is this intended? or should i not need the explicit requires?
[12:26:00] JJonah: *.net *.split
[12:27:27] JJonah: has joined #ruby
[12:27:36] JJonah: has joined #RubyOnRails
[15:01:31] JJonah: *.net *.split
[15:03:03] JJonah: has joined #RubyOnRails
[15:03:11] JJonah: has joined #ruby


[00:56:25] JJonah: what is the correct way to instantiate an object in rails that can be reused across multiple requests? that is, it can be created during application bootup, but then needs to be used by a controller?
[00:57:52] JJonah: Radar: it verifies security requirements, but the context isn't necessarily relevant for my question
[00:59:37] JJonah: Radar: Think something like at bootup: `@security = Security.new(ENV['blah], etc)`. Then in an authenticate controller: `@security.validate(param1, param2)`
[01:01:08] JJonah: Wasn't clear to me if that belonged in an initializer or not
[01:03:36] JJonah: Radar: Yeah, looks like that's the correct answer for what I want: https://stackoverflow.com/questions/6517914/how-to-create-an-app-wide-object (according to the accepted answer, anyway)
[03:34:13] JJonah: If your rails controller references `ENV['some-var']`, and the value of it changes while the app is running at 10pm, will a request served at 10:01pm show the new value, or the value at the time the app was started? That is, does rails cache environment values, or reread them on every request?
[04:15:29] JJonah: Radar: This one is in a controller, so will it be reread on each request?
[10:48:06] JJonah: Radar: thanks


[16:02:09] JJonah: I am converting an application to a gem, and so I need to move the dependencies in my Gemfile into gemspec. Curious if there are any tools that do this automatically?
[16:33:20] JJonah: havenwood: yeah, that probably makes sense re: the lock. In my particular case, I think I'll just spend the 5minutes to do by hand now :). I just figured if there was a standard thing people did, I'd use that...
[16:37:21] JJonah: havenwood: thanks


[04:18:56] JJonah: has joined #ruby
[04:18:56] JJonah: has joined #RubyOnRails
[15:31:01] JJonah: Read error: Connection reset by peer
[15:35:29] JJonah: has joined #ruby
[15:35:29] JJonah: has joined #RubyOnRails


[23:26:28] JJonah: has joined #ruby
[23:26:28] JJonah: has joined #RubyOnRails
[23:26:46] JJonah: Max SendQ exceeded
[23:27:25] JJonah: has joined #ruby
[23:27:25] JJonah: has joined #RubyOnRails