NL3limin4t0r

Activity Graph

Page 1 of 7 | Next »

2019-09-20

[13:00:37] NL3limin4t0r: fritzroy15: In JS: `JSON.stringify({x: 5, y: 6}) //=> "{\"x\":5,\"y\":6}"`
[14:16:27] NL3limin4t0r: ¯\_(ツ)_/¯ kappa
[14:19:42] NL3limin4t0r: Social justice only accepts those who have been validated to agree. Unknown user-agents don't belong to that list apparently. =P
[15:41:05] NL3limin4t0r: gcstr: Have you tried `record.regenerate_token` ?
[15:41:11] NL3limin4t0r: https://api.rubyonrails.org/classes/ActiveRecord/SecureToken/ClassMethods.html#method-i-has_secure_token
[15:45:22] NL3limin4t0r: gcstr: np, if you want to update all your records you'll have to do something like `Model.where(token: nil).find_each(&:regenerate_token)`
[15:46:53] NL3limin4t0r: Although that might not work now I think about it since the collection shifts, but you get the point.
[16:07:42] NL3limin4t0r: Now you leave me wondering what the difference between modify and change is. xD
[16:16:26] NL3limin4t0r: I guess I expected something like that.
[16:16:42] NL3limin4t0r: But ty for the quick search.
[16:54:28] NL3limin4t0r: robotcars: ctime is not the creation time, it's change time
[16:55:45] NL3limin4t0r: robotcars: You should use #birthtime if you want to sort by creation time
[16:58:20] NL3limin4t0r: greengriminal: I personally have no experience with that gem, but without info we can't help. What's the problem?

2019-09-18

[11:44:21] NL3limin4t0r: naftilos76: You can run `bundle exec rails assets:precompile` to compile the assets.
[11:45:02] NL3limin4t0r: naftilos76: https://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets
[11:51:38] NL3limin4t0r: ytti: What have you tried? Both `doc.css('table')` and `doc.xpath('//table')` should work.
[12:08:37] NL3limin4t0r: ytti: Match the element above table instead and work from there.
[12:09:07] NL3limin4t0r: doc.xpath("//*[table]")
[12:11:16] NL3limin4t0r: The `//` means, anywhere in the document. `*` means, any element. `[table]` means, that it must have a `table` node as direct child.
[12:11:43] NL3limin4t0r: So any element in the document having a table child.
[12:13:06] NL3limin4t0r: You could also work with the current doc.xpath('//table') solution, and request the parent of the table.
[12:14:19] NL3limin4t0r: `doc.xpath('//table').each { |table| table.parent }` and use that to access the wanted node/attribute.
[12:16:47] NL3limin4t0r: Checkout the xpath references if your interested in xpath. https://github.com/sparklemotion/nokogiri/wiki/Cheat-sheet
[16:25:39] NL3limin4t0r: bougyman: Your question is a bit unclear, but you can just `define_singleton_method do |keyword1:, keyword2: nil, **rest|`
[16:32:46] NL3limin4t0r: naftilos76: The "hash" or figerprint is used to invalidate older versions and unless you've changed a specific setting they are also used in production.
[16:33:33] NL3limin4t0r: s/to invalidate older versions/to invalidate older versions of chached assets/
[16:44:09] NL3limin4t0r: Normally the url simply points to your production server unless you've setup an CDN in which case asset url should be pointed to that.
[17:16:25] NL3limin4t0r: Yep, that's it. If level_up_24.png would ever be changed a pixel the fingerprint changes, thus automatically updating the css and by doing so changing the finger print of the css. This way anything that uses a cached version of the css knows their current version is out of date.
[17:19:29] NL3limin4t0r: A detailed version of why finger is important can be found here
[17:19:35] NL3limin4t0r: https://guides.rubyonrails.org/asset_pipeline.html#what-is-fingerprinting-and-why-should-i-care-questionmark
[17:20:08] NL3limin4t0r: s/why finger is/why fingerprinting is/
[17:37:02] NL3limin4t0r: Because `level_up_24.png` will only be avaible to the server as file. Clients can never request the `level_up_24.png` file, they can only request the fingerprinted version. For this reason all references to (the location of) this file must also include the fingerprint.
[17:37:53] NL3limin4t0r: It should be there, but only for production.
[17:40:26] NL3limin4t0r: If the compiled version doesn't reference the fingerprinted url you might have `config.assets.digest = false` present somewhere in your application.rb or production.rb.
[17:41:05] NL3limin4t0r: That option toggle digesting (fingerprinting) the assets.
[17:45:27] NL3limin4t0r: ^ and defaults to `true`
[20:57:12] NL3limin4t0r: balo: If it isn't closed it might still be in. However there is no large presure to fix it since everything works as expected. The only issue is that the error message is too cryptic for a normal Rails user.
[20:59:52] NL3limin4t0r: Like OP said (https://github.com/rails/rails/issues/15811#issuecomment-46573654) he forgot to provide the :class_name option.
[21:00:23] NL3limin4t0r: > has_many :comments, as: :commentable
[21:01:08] NL3limin4t0r: > has_many :comments, as: :commentable, class_name: 'Comment::Base'
[21:02:45] NL3limin4t0r: oops that reference to the comment should be https://github.com/rails/rails/issues/15811#issuecomment-46992484

2019-09-16

[09:14:57] NL3limin4t0r: Quit: WeeChat 1.9.1
[09:25:37] NL3limin4t0r: has joined #ruby
[09:25:43] NL3limin4t0r: has joined #RubyOnRails
[09:36:53] NL3limin4t0r: No, the ENV hash is loaded from the environment variables but isn't a live connection.
[09:37:29] NL3limin4t0r: If you change ENV, exit the irb session and start irb again ENV will be reset.
[09:38:36] NL3limin4t0r: Oh, I understand it wrong. It does take into acount variables set in the terminal.
[09:41:56] NL3limin4t0r: Running `FOO="bar" irb` will result in `ENV["FOO"] #=> "bar"`
[15:36:16] NL3limin4t0r: yep, but haven't much experience using webpacker
[15:37:40] NL3limin4t0r: We still have to upgrade our Rails application to v6. We're currently using 5.2
[15:41:06] NL3limin4t0r: GeorgesLeYeti: Seems like the allowed tags come mostly from the sanitizer. You could set your own sanatizer to allow your aditional tags.
[15:41:26] NL3limin4t0r: https://github.com/rails/rails/blob/9b6433bb82f1462bbf1bec314998babca00e34ab/actiontext/app/helpers/action_text/content_helper.rb#L7
[15:42:13] NL3limin4t0r: Create an initializer file and simply do something like `ActionText::ContentHelper.sanitizer = YourSanitizer.new`
[15:43:38] NL3limin4t0r: If needed you can let you sanitizer inherit by what Rails already provides. `class YourSanitizer < Rails::Html::Sanitizer.safe_list_sanitizer`
[16:04:03] NL3limin4t0r: Are you using it the same way Array#sort! where it accepts 2 arguments and compares them some way?

2019-09-13

[14:25:40] NL3limin4t0r: kapil_: Writing that line with parentheses would look like: `inherit_done_ratio(ancestor, leaves) if inherit?(attributes, :done_ratio)`
[15:06:53] NL3limin4t0r: throstur: If the initialization can't raise any exceptions you could do something like this.
[15:07:00] NL3limin4t0r: throstur: https://gist.github.com/3limin4t0r/79ad4cc9b3886dea60d112aa2f7db40e
[16:07:05] NL3limin4t0r: sapphyrus: If you're building a an command line tool. You can also give "thor" a look, which does command line argument parsing for you.
[16:07:08] NL3limin4t0r: http://whatisthor.com/
[16:08:10] NL3limin4t0r: https://rubygems.org/gems/thor
[16:12:13] NL3limin4t0r: I'm not sure if it fits your scenario, you'll have to figure that out for yourself.
[16:14:17] NL3limin4t0r: You should be able to use `@event = Event.find(params[:id])`.
[16:14:37] NL3limin4t0r: xco: Are you sending postman to the right URL?
[16:16:12] NL3limin4t0r: How is the route setup?
[16:16:32] NL3limin4t0r: You might need to use `params[:event_id]` in that scenario.
[16:17:57] NL3limin4t0r: check `bundle exec rails routes | grep purchase`
[16:21:59] NL3limin4t0r: Yeah, the `2` in your request should be bound to `params[:event_id]`. What does the Rails server log say about incomming parameters on request?
[16:27:10] NL3limin4t0r: Seems like it finishes without issue. "Completed 204 No Content in 79ms (ActiveRecord: 13.9ms)"
[18:01:05] NL3limin4t0r: pgib: += doesn't really work, you can however use <<
[18:01:21] NL3limin4t0r: pgib: https://api.rubyonrails.org/classes/ActiveRecord/Associations/CollectionProxy.html#method-i-3C-3C
[18:05:15] NL3limin4t0r: pgib: I'm not entirely sure about that one. I'd say try it out with some dummy data. However I assume that `new_tag.save!` would do the trick.
[18:07:26] NL3limin4t0r: pgib: If that doesn't work you'll have to iterate over the posts `new_tag.posts.each(&:save!)` or setup autosave through the association options.
[18:08:18] NL3limin4t0r: But when using `has_and_belongs_to_many` I beleive it is pre-setup for the join table.
[18:11:34] NL3limin4t0r: If you're wondering what I'm talking about when mentioning "autosave" check out https://guides.rubyonrails.org/association_basics.html#options-for-belongs-to-autosave
[18:15:39] NL3limin4t0r: duleja: You can use #includes in combination with #references.
[18:15:56] NL3limin4t0r: https://api.rubyonrails.org/classes/ActiveRecord/QueryMethods.html#method-i-references
[18:16:31] NL3limin4t0r: Do you have an example?
[18:23:03] NL3limin4t0r: Yeah, I just checked my rails console. When using refernces it seems like it always loads all columns.
[18:23:54] NL3limin4t0r: In most cases people simply load all attributes.
[18:24:46] NL3limin4t0r: Sec, I'll quickly create an example.
[18:30:43] NL3limin4t0r: So, this is not the most pretty. But you could do something like this: https://gist.github.com/3limin4t0r/b648f60718769744ca2fca5277c03a43
[18:32:45] NL3limin4t0r: Simply first selecting the casinos you want. Then loading all the software belonging to the selected casinos and group them based upon casino. When iterating the casinos don't use `casino.sofwares` but `casino_softwares[casino.id]` instead.
[18:34:03] NL3limin4t0r: A pretty lame solution. Maybe someone else knows how to preload associations with only specific columns.
[18:41:19] NL3limin4t0r: I'm not sure if this is worth the hassle. You might be better of simply preloading the associations with all attributes.
[18:46:30] NL3limin4t0r: https://gist.github.com/3limin4t0r/cc29c111efa2cdb738d4c26bed06c63c
[18:54:17] NL3limin4t0r: Yep, for large collection you indeed don't want to do it this way.
[18:57:50] NL3limin4t0r: Say you have 10k casinos registered with 2k softwares each. That means you need to load 10,000 + 10,000 * 2,000 = 20,010,000 records in memory. From which 20,000,000 need to be grouped by casino_id.
[19:00:42] NL3limin4t0r: You shouldn't really worry about scalability unless it's becoming an issue.
[19:01:04] NL3limin4t0r: Normally you batch load records when working with large amounts of records.
[19:02:49] NL3limin4t0r: That's why Rails offers the #find_each method that can be used instead of #each. It loads records in batches of 1000 (by default).
[19:04:07] NL3limin4t0r: Have a look at https://guides.rubyonrails.org/active_record_querying.html#retrieving-multiple-objects-in-batches and https://api.rubyonrails.org/classes/ActiveRecord/Batches.html if you're interested.
[19:06:26] NL3limin4t0r: Say you have 10 fields, then you're simply loading a bit of data extra by loading the whole record (unless you've got a large text or blob column).
[19:10:32] NL3limin4t0r: I've gotta go though. gl duleja

2019-09-12

[08:20:08] NL3limin4t0r: good morning 🙋
[08:47:30] NL3limin4t0r: I'm doing good. I'm fine with it being Thursday, I've got dance class this evening which is quite fun.
[08:48:02] NL3limin4t0r: Teckuro: Do you have something planned this weekend, or simply wish the work week is over?
[09:03:26] NL3limin4t0r: Teckuro: Modern Jazz. I have to get my sleeping scedule fixed as well.

2019-09-11

[09:35:33] NL3limin4t0r: throstur: If the key value is always followed by a '\n' you can simply use `/(?<=Key: )(?:[^\\]|\\(?!n))/`
[09:36:16] NL3limin4t0r: There should be a start at the end ^
[09:36:38] NL3limin4t0r: `/(?<=Key: )(?:[^\\]|\\(?!n))*/`
[09:37:18] NL3limin4t0r: It simply says after `Key: ` match anything that is not an `\` character or an ``
[09:37:38] NL3limin4t0r: It simply says after `Key: ` match anything that is not an `\` character or an `\` character not followed by an `n` zero or more times.
[10:29:28] NL3limin4t0r: Yeah, my third message fixes that. There should be an `*` at the end of the regex.
[10:29:53] NL3limin4t0r: Yeah, if you expect no empty values.
[10:32:03] NL3limin4t0r: Do keys have restrictions? Can they contain spaces?
[10:34:38] NL3limin4t0r: Is there always a space for a key?
[10:35:56] NL3limin4t0r: `(?<= )(\w+): ((?:[^\\]|\\(?!n))*)`
[10:36:39] NL3limin4t0r: Assuming key can only contains `[a-zA-Z0-9_]`
[10:37:23] NL3limin4t0r: capturing the key in group 1 and value in group 2
[10:39:17] NL3limin4t0r: If a string can begin with a key you might want to change `(?<= )` to `(?<=\A|=)` wich means that it can come right after the start of the string or followed upon a space.
[10:39:55] NL3limin4t0r: Oops, I mean `(?<=\A| )`
[10:40:35] NL3limin4t0r: Yea can that do after though.
[10:41:24] NL3limin4t0r: If you're running a newer version of Ruby simply `result.to_h.transform_keys(&:to_sym)`
[10:41:44] NL3limin4t0r: Calling `.to_sym` on all the keys.
[10:42:51] NL3limin4t0r: Hash#transform_keys is introduced in 2.5.0
[12:12:57] NL3limin4t0r: Nah, you could question yourself why you do the first #transform_keys on a different like than the other.
[12:13:40] NL3limin4t0r: You could also considder using the mutating version #transform_keys! instead, assuming you don't need the previous result.
[12:14:10] NL3limin4t0r: throstur: https://dpaste.de/E0uG
[12:16:38] NL3limin4t0r: fyi `%i[downcase to_sym]` equals `[:downcase, :to_sym]`
[12:17:45] NL3limin4t0r: I think I would go for the last since it's the fastest in iterations and doesn't need throw away variables.
[12:18:52] NL3limin4t0r: https://dpaste.de/FPZH
[12:19:04] NL3limin4t0r: Would be my choise
[12:24:38] NL3limin4t0r: You could also shorten the regex further to `/ (\w+): (.*?)\\n/m` since you only care about the groups and not the entire match.
[12:26:04] NL3limin4t0r: But I'm not the biggest fan of lazy quantifiers myself.
[12:47:47] NL3limin4t0r: In your current case the ! is indeed unneeded. I used it to skip variable assignment.
[12:48:18] NL3limin4t0r: You could also use `line.scan(capture_regex).map { |key, value| [key.downcase.to_sym, value.strip] }.to_h`
[12:48:56] NL3limin4t0r: Depending on what you find more readable.
[12:50:22] NL3limin4t0r: &>> [[1, 2], [3, 4]].map { |v1, v2| [v1 + 1, v2 * v2] }
[12:54:03] NL3limin4t0r: Because the result of map is going to be: `[[key1, value1], [key2, value2], ...]` and I assume you want: `{key1: value1, key2: value2, ...}`
[12:54:42] NL3limin4t0r: yes you can, but the result is an array
[12:57:11] NL3limin4t0r: The reason I don't call #to_h before #map is because you can use array decomposistion in blocks.
[12:57:16] NL3limin4t0r: https://ruby-doc.org/core-2.6.4/doc/syntax/assignment_rdoc.html#label-Array+Decomposition
[12:57:42] NL3limin4t0r: Basically you have an array with other arrays (the regex groups).
[12:58:16] NL3limin4t0r: Meaning that every element is an array by itself.
[12:59:04] NL3limin4t0r: &>> [['key1', 'value1'], ['key2', 'value2']].all?(/Array/)
[12:59:34] NL3limin4t0r: &>> [['key1', 'value1'], ['key2', 'value2']].all?(Array)
[13:00:27] NL3limin4t0r: aka `[['key1', 'value1'], ['key2', 'value2']].all? { |item| item.is_a? Array }`
[13:00:43] NL3limin4t0r: when you put a comma in the block it breaks down the array
[13:01:32] NL3limin4t0r: &>> [['key1', 'value1'], ['key2', 'value2']].map { |item,| item } # note the comma
[13:03:33] NL3limin4t0r: So you can get the first and second value of the current item by simply using the destruction assignment (basically treating it as a hash)
[13:07:25] NL3limin4t0r: I hope my explenation is not to confusing.
[13:13:24] NL3limin4t0r: You should be able to use $logger in script B.
[13:21:19] NL3limin4t0r: Considder implementing a null pattern for your $logger. That way you don't have to check if `$logger` is set before logging. You can simply assue that it's there, if the null pattern logger is set it simply discards everything.
[13:21:37] NL3limin4t0r: s/assue/assume/
[13:23:28] NL3limin4t0r: https://en.wikipedia.org/wiki/Null_object_pattern
[13:44:59] NL3limin4t0r: You could for example use $stdout by default in your logger, but allow the user to give their own output stream. This way you can provide `File.open(File::NULL, 'w')` as output stream if you don't want any logging.
[13:45:35] NL3limin4t0r: &>> File::NULL
[17:55:47] NL3limin4t0r: Is there a way to call the `||=` operator upon a dynamic attribute. I'm guessing `obj.public_send("attr||=", val)` is not going to work.
[17:58:19] NL3limin4t0r: Technically it's a shorthand for `attr || attr = val`
[17:59:50] NL3limin4t0r: So simply translate it to `obj.public_send("attr") or obj.public_send("attr", val)` I guess
[18:00:25] NL3limin4t0r: That last part should be `obj.public_send("attr=", val)` (forgot the =)
[18:01:36] NL3limin4t0r: phaul: That's correct. &&= has the same behaviour though.
[18:04:36] NL3limin4t0r: Nah, I also assumed it to be `attr = attr || val` until I stumbled upon this fact once. But normally it doesn't really matter, only in some edge cases.

2019-09-09

[14:39:36] NL3limin4t0r: The #add_foreign_key doesn't specify what the defaults are. I assume database defaults will be used, but was wondering if this is indeed the case.
[14:42:11] NL3limin4t0r: In my case both :on_delete and :on_update would then default to :restrict. Since I use MariaDB. "RESTRICT: The change on the parent table is prevented. The statement terminates with a 1451 error (SQLSTATE '2300'). This is the default behaviour for both ON DELETE and ON UPDATE." https://mariadb.com/kb/en/library/foreign-keys/#constraints
[14:45:13] NL3limin4t0r: ^ https://api.rubyonrails.org/v5.2.3/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-add_foreign_key
[14:49:21] NL3limin4t0r: My god I can't type... The first sentence should be: The #add_foreign_key documentation doesn't specify what the defaults for the :on_delete and :on_update options are.
[17:53:08] NL3limin4t0r: ryouba: You can't reassign `self`. Normally you build the mutating version first. Then for the non-mutating version #dup self and call the mutating variant.
[17:53:28] NL3limin4t0r: ryouba: Something like this might give you some inspiration. https://gist.github.com/3limin4t0r/d52bc6f130e0efac1489750914493461

2019-09-04

[13:03:50] NL3limin4t0r: paddy: Checkout this SO question: https://stackoverflow.com/q/9727908/3982562
[13:06:28] NL3limin4t0r: The question might be 7 years old, but have you check if the "zlib1g-dev" or "zlib-devel" package is installed on your system?
[13:11:59] NL3limin4t0r: If you haven't already, first update your package list `[sudo] dnf check-update`. Then run `dnf search zlib` and see what comes back.
[13:35:03] NL3limin4t0r: paddy: Anything with "zlib" as a result of the above?
[13:51:39] NL3limin4t0r: You can remove rvm by running `rvm implode` then reinstall it as normal user.
[14:01:09] NL3limin4t0r: yeah, I know the feeling

2019-09-02

[09:35:58] NL3limin4t0r: dionysus69: Raise a 400 (Bad Request): The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.
[09:37:30] NL3limin4t0r: I beleive it's build into Rails, give me a sec looking up some documentation.
[09:38:55] NL3limin4t0r: Found it: https://guides.rubyonrails.org/layouts_and_rendering.html#options-for-render
[09:39:12] NL3limin4t0r: `render status: :bad_request`
[09:40:18] NL3limin4t0r: Or `render status: 400` if you prefer with the status codes instead. I personally find the symbols more clear.
[09:40:56] NL3limin4t0r: s/prefer with/prefer to work with/
[09:44:17] NL3limin4t0r: Keep in mind that you want to set an timeout on login attempts to prevent brute forcing an account if you haven't already.
[09:50:14] NL3limin4t0r: What response are you currently getting?
[09:50:20] NL3limin4t0r: An 400 or 500?
[09:54:28] NL3limin4t0r: From what I see in the config it should be an 400, so it's aready returning the correct thing.
[09:55:00] NL3limin4t0r: https://guides.rubyonrails.org/configuring.html#configuring-action-dispatch search for "config.action_dispatch.rescue_responses"
[09:58:44] NL3limin4t0r: Ah, so the problem isn't really that the requests is handled incorrectly, but rather that it fills up logs to fast.
[10:04:24] NL3limin4t0r: I don't know if that's possible. Rails allows log levels, but when you set config.log_level = :fatal you don't see any other exceptions either. It would be cool if there was a config where you can blacklist certain exceptions from logging.
[10:08:52] NL3limin4t0r: There are different log options. There is config.logger which let you set your own logger class. There meight be logger gems out there that have that functionality, or you can build your own.
[10:10:52] NL3limin4t0r: Or - what might accually be better - you could check out the ActiveSupport::TaggedLogging/ActiveSupport::Logger documentation to see what functionality they offer out of the box.
[10:13:04] NL3limin4t0r: https://api.rubyonrails.org/classes/ActiveSupport/TaggedLogging.html
[10:15:20] NL3limin4t0r: Seems like it's pretty bare bones. I have to get some work done, I wich you good luck.
[13:32:00] NL3limin4t0r: ryouba: Hash.new { |hash, key| hash[key] = Hash.new(&hash.default_proc) }
[13:32:48] NL3limin4t0r: Ah, didn't had a look at that yet.
[18:52:33] NL3limin4t0r: leftylink: What's the question?

2019-08-30

[09:34:41] NL3limin4t0r: has joined #ruby
[09:34:47] NL3limin4t0r: has joined #RubyOnRails
[14:08:27] NL3limin4t0r: al2o3-cr: In the case of irb it uses String#% `"foo" % 42 #=> "foo"`, but I don't know about the first percent sign.
[14:11:25] NL3limin4t0r: And it uses the percent sign litteral I guess for the first part. %(foo) #=> "foo"
[14:11:44] NL3limin4t0r: but with an [Enter] seperator instead of ()
[14:16:29] NL3limin4t0r: al2o3-cr: If the plan is to use multiline strings your better of using HEREDOC instead. But I guess that wan't the intention.
[14:22:50] NL3limin4t0r: psprint: If you want to do a local install from source you first have to build the gem, then install it.
[14:23:25] NL3limin4t0r: psprint: `gem build path/to/file.gemspec` then `gem install path/to/file.gem`
[14:25:36] NL3limin4t0r: psprint: The submodule part might be better asked in the #git irc. But here is a helpfull link: https://git-scm.com/book/en/v2/Git-Tools-Submodules
[14:26:50] NL3limin4t0r: al2o3-cr: Nah, sometime you just need an extra pair.
[14:27:49] NL3limin4t0r: zodd_: Ruby doesn't come with a database connection. Are you using Rails?
[14:31:19] NL3limin4t0r: The https://www.ruby-toolbox.com/categories Data Persistence section might have some usefull gems that you can use.
[14:33:59] NL3limin4t0r: Depending on the type of database the "pg", "mysql2" and "sqlite3" are the most populair (due to the fact that they are used by Rails).
[14:36:50] NL3limin4t0r: mjacob: I'm not sure, but there are a few documented here: https://guides.rubyonrails.org/active_record_migrations.html#creating-a-migration

2019-08-29

[12:06:14] NL3limin4t0r: gheegh: Does the info change during runtime?
[12:08:32] NL3limin4t0r: I'd say load it once when your gem is loaded, and assign it to a constant or class instance variable. Then use that instead of loading it from the file each time. Constants should stay loaded.
[12:09:29] NL3limin4t0r: You can also change the file format to use YAML or JSON instead if that better suits your needs.
[12:10:35] NL3limin4t0r: Rails loads it's config into `Rails.conf` for example. Which is just an class instance variable accessor.
[12:13:05] NL3limin4t0r: Don't mind my comment about `Rails.conf` that's not entirely valid. They hide it somewhere else, but most gems do something like `GemName.config`.
[12:14:00] NL3limin4t0r: IGnorAND: good day
[12:14:51] NL3limin4t0r: gheegh: `def self.conf; @conf ||= load_stuff; end`
[12:17:28] NL3limin4t0r: `@config ||= load_stuff` should only load @config if it's falsey. If @config is a class instance variable it should stay loaded as long as the class is loaded.
[12:19:10] NL3limin4t0r: Can you provide a small code snippet?
[12:20:35] NL3limin4t0r: IGnorAND: Hadn't thought of that, but no. IRC nicks aparently can't start with a numer, so I had to put some letters in front of them.
[12:21:02] NL3limin4t0r: And since I'm dutch I simply added NL.
[12:24:09] NL3limin4t0r: IGnorAND: that's true :-)
[14:12:37] NL3limin4t0r: gheegh: I'd say create another handle that caches the result of `parse` and uses that instead.
[14:36:44] NL3limin4t0r: mustmodify__: You can provide a range not to match. `/[^\u{0}-\u{FF}]/`
[14:36:56] NL3limin4t0r: leitz: It's a no from me at least.
[14:40:39] NL3limin4t0r: mustmodify__: Basic ascii is 0000-007F.
[18:08:46] NL3limin4t0r: Quit: WeeChat 1.9.1

2019-08-28

[18:27:58] NL3limin4t0r: teser: Adding to what jacksop already said. You can find the Ruby documentation about string interpolation here: https://ruby-doc.org/core-2.6.3/doc/syntax/literals_rdoc.html#label-Strings and the documentation about instance variables here: https://ruby-doc.org/core-2.6.3/doc/syntax/assignment_rdoc.html#label-Instance+Variables

2019-08-26

[13:11:33] NL3limin4t0r: Tuor: If you don't expect the filename to change it probably fine, but I agree with phaul in that I would also use a string in that context. Using a symbol is like using an enum in other languages. They will be added to the `Symbol.all_symbols` list and will remain loaded during the entirety of your program.
[13:12:09] NL3limin4t0r: In this short script it doesn't really matter though.

2019-08-23

[10:01:07] NL3limin4t0r: has joined #ruby
[10:01:19] NL3limin4t0r: has joined #RubyOnRails

2019-08-22

[00:56:33] NL3limin4t0r: *.net *.split
[01:13:34] NL3limin4t0r: has joined #RubyOnRails
[01:13:39] NL3limin4t0r: has joined #ruby
[11:49:18] NL3limin4t0r: Quit: WeeChat 1.9.1

2019-08-21

[09:00:13] NL3limin4t0r: has joined #ruby
[09:00:18] NL3limin4t0r: has joined #RubyOnRails
[09:58:23] NL3limin4t0r: Does anybody know if there is a way using the factory_bot/factory_bot_rails gem to mark a factory as abstract. I've got one factory that isn't valid by itself, but holds all the common attributes.
[10:03:32] NL3limin4t0r: I currently have the issue that I often do `create(:relation)` and are greeded with the exception "ActiveRecord::RecordInvalid". Leaving me thinking where did I do something wrong? However I'd like to see something like "this is an abstract factory you dummy". Letting me realize sooner that I should use `create(:household_relation)` or `create(:company_relation)`.

2019-08-19

[08:44:42] NL3limin4t0r: aolko: You can also partialy require parts of a module/gem. For example `require 'active_support/core_ext/object/deep_dup'`
[08:49:06] NL3limin4t0r: It doesn't always work easily, since some modules might not have the needed dependencies set up (since they assumed to be loaded).
[08:49:40] NL3limin4t0r: For example let's say you want to load all core extensions of active support.
[08:50:34] NL3limin4t0r: This would be `require 'active_support/core_ext'`, but fails with "NameError: uninitialized constant ActiveSupport::Autoload".
[08:51:24] NL3limin4t0r: So you need to require autoload first. `require 'active_support/dependencies/autoload'`
[16:41:40] NL3limin4t0r: Quit: WeeChat 1.9.1

2019-08-16

[10:24:41] NL3limin4t0r: repo: Are you using devise?
[10:26:55] NL3limin4t0r: https://rubydoc.info/github/plataformatec/devise/#Controller_filters_and_helpers
[10:27:16] NL3limin4t0r: > For Rails 5, note that protect_from_forgery is no longer prepended to the before_action chain, so if you have set authenticate_user before protect_from_forgery, your request will result in "Can't verify CSRF token authenticity." To resolve this, either change the order in which you call them, or use protect_from_forgery prepend: true.
[10:29:53] NL3limin4t0r: Although the above talks about Rails 5, it might be worth trying out.

2019-08-15

[16:25:24] NL3limin4t0r: Quit: WeeChat 1.9.1
[16:33:49] NL3limin4t0r: has joined #ruby
[16:33:54] NL3limin4t0r: has joined #RubyOnRails