« Back to channel list

#ruby - 10 July 2019

« Back 1 day Forward 1 day »
[00:05:35] DaRock: has joined #ruby
[00:09:53] DTZUZO: has joined #ruby
[00:13:06] cd: has joined #ruby
[00:17:01] queip: has joined #ruby
[00:17:57] nowhereman: has joined #ruby
[00:45:44] lepepe: has joined #ruby
[00:51:34] snowy: has joined #ruby
[01:04:19] skryking: has joined #ruby
[01:04:36] involans: has joined #ruby
[01:06:44] fphilipe: has joined #ruby
[01:09:31] cagomez: has joined #ruby
[01:11:51] haxx0r: has joined #ruby
[01:15:24] ElFerna: has joined #ruby
[01:23:41] codefriar: has joined #ruby
[01:28:30] Guest42592: has joined #ruby
[01:50:31] chalkmonster: has joined #ruby
[01:55:44] jenrzzz_: has joined #ruby
[02:06:31] thebananaking: has joined #ruby
[02:07:21] thebananaking: I've got a stupid syntax error and I haven't had coffee yet. Someone sanity check?
[02:07:38] thebananaking: lines=IO.readlines(dbfile).select {|line| aliases.any? {|alias| line.match /alias/}}
[02:09:47] baweaver: s the error say?
[02:10:00] baweaver: alias is a reserved word
[02:10:11] baweaver: Also that regex will be literally alias
[02:10:20] baweaver: You can also make that a lot faster
[02:10:38] thebananaking: argh fuck thanks for that, will fix
[02:10:44] baweaver: aliases = Regexp.union([array, of, regexes])
[02:10:57] baweaver: ines=IO.readlines(dbfile).grep(aliases)
[02:11:06] thebananaking: alias being reserved would do it :P
[02:11:21] thebananaking: woah, you can grep(array)?
[02:11:34] baweaver: grep works with === so it can use regex
[02:11:34] baweaver: If you did a union on it
[02:11:39] baweaver: Regexp.union(array)
[02:12:01] baweaver: &>> Regexp.union([/a/, /b/, /c/])
[02:12:04] rubydoc: # => /(?-mix:a)|(?-mix:b)|(?-mix:c)/ (https://carc.in/#/r/77ba)
[02:12:15] baweaver: &>> Regexp.union([/a/, /b/, /c/]).match 'a'
[02:12:15] rubydoc: # => #<MatchData "a"> (https://carc.in/#/r/77bb)
[02:12:16] thebananaking: love it, many thanks
[02:13:53] thebananaking: heh, Regexp.union(%w{a b c}) # => /a|b|c/
[02:33:20] jenrzzz: has joined #ruby
[02:40:58] sarink: has joined #ruby
[02:43:49] lepepe: has joined #ruby
[02:47:37] jaequery: has joined #ruby
[02:52:44] involans: has joined #ruby
[02:53:19] bjpenn: has joined #ruby
[02:53:42] zacts: has joined #ruby
[02:57:11] _whitelogger: has joined #ruby
[03:06:59] cyclonis: has joined #ruby
[03:07:44] fphilipe: has joined #ruby
[03:09:17] braincrash: has joined #ruby
[03:18:04] redlegion: has joined #ruby
[03:19:17] involans: has joined #ruby
[03:22:22] snowy: has joined #ruby
[03:22:37] sarink: has joined #ruby
[03:33:10] _whitelogger: has joined #ruby
[03:34:53] bjpenn: has joined #ruby
[03:39:54] bjpenn: has joined #ruby
[03:46:01] cyclonis: has joined #ruby
[03:47:07] cyclonis: has joined #ruby
[03:47:33] cyclonis: has joined #ruby
[03:49:32] tdy4: has joined #ruby
[04:03:08] fphilipe: has joined #ruby
[04:18:30] Swyper: has joined #ruby
[04:21:08] Polysics: has joined #ruby
[04:21:21] DTZUZO: has joined #ruby
[04:21:33] Polysics: I have an amnesia moment. Is there a way to define an array of constants on a class?
[04:21:43] zacts: has joined #ruby
[04:21:53] jenrzzz: has joined #ruby
[04:22:07] baweaver: polysics: how so?
[04:22:11] Swyper: has joined #ruby
[04:22:11] Polysics: I am dealing with an API that has lengthy event names, and they are separated on a few groups
[04:22:35] Polysics: so I'd like to do something like CALL_STATE::RINGING to reference them
[04:23:01] Polysics: I guess I can just name them TYPE_SUBTYPE, but it was more of a generic question I came up with
[04:23:36] baweaver: Hashes, possibly
[04:24:33] Polysics: because the actual name is something like 'event.calling.call.call_state.ringing' because I assume it is mapped from some undelying relationship
[04:24:39] Polysics: how would that look, please?
[04:25:09] baweaver: So you need an arbitrarily deep structure of events?
[04:25:27] Polysics: no, I can make do with two levels
[04:25:47] Polysics: let's say "call_state.ringing" is what matters
[04:25:50] baweaver: Just make a module that wraps a set of constants
[04:26:08] Polysics: there sill be "call_connect.started", "call_play.finished" etc
[04:26:31] Polysics: and how would the constants be arranged?
[04:27:01] baweaver: class Something; module GroupA; CONSTS
[04:27:19] Polysics: oh, so there is no way to do a hash of constants, gotcha
[04:27:33] baweaver: Hash keys could be anything
[04:27:34] Polysics: I was almost sure I had seen it somewhere but I was probably seein things, I guess
[04:30:49] Polysics: baweaver: you mean something like this?
[04:31:06] Polysics: module CallState
[04:31:06] Polysics: RINGING = 'long_event_name'
[04:31:08] Polysics: module CallPlay
[04:31:10] Polysics: STARTED = 'some more long name'
[04:31:14] Polysics: oops wtf, sorry
[04:31:24] Polysics: yes, my bad
[04:31:33] Polysics: wrong focused window.
[04:32:28] Polysics: yes, thinking about it, I can't think of a syntax that would allow for an actual hash of constants to be defined
[04:33:18] Polysics: is a module name in all caps bad-looking?
[04:33:29] Polysics: so that it is clear it is only a constant holder
[04:36:01] Polysics: you can ofc have an hash as a constant but that has a confusing syntax to use
[04:36:05] Polysics: MyModel::SOME_ATTR_OPTIONS[:first_option]
[04:44:34] haxx0r: how to validate that the PGP key a user provided to encrypt emails is valid
[04:46:01] Polysics: you should probably be shelling out to pgp/pgp2
[04:46:34] haxx0r: no ruby gem to check it? thats bad
[04:46:35] Polysics: though it looks like IOStreams has some PGP stuff in it
[04:47:03] Polysics: apparently you are right
[04:47:03] Polysics: https://github.com/rocketjob/iostreams
[04:47:08] haxx0r: i wanna run like `validates :pgp_key, pgp: true`
[04:47:27] Polysics: you can always write it
[04:48:31] Polysics: https://github.com/ueno/ruby-gpgme
[04:48:43] haxx0r: that gem is just a wrapper class for the shell, isn't?
[04:49:33] haxx0r: mmh. i'll cook food and will recheck in 20 minutes
[04:49:39] Polysics: don't know, go check out the source code - I looked for 10 seconds and it looks like it's an actual implementation
[04:49:46] Polysics: (referring to gpgme)
[04:49:53] Polysics: gpgme has a "verify" method too
[04:53:36] lepepe: has joined #ruby
[04:57:24] sarink: has joined #ruby
[04:58:50] sarink: has joined #ruby
[05:02:53] matheusmoreira: has joined #ruby
[05:03:43] haxx0r: lets see, i'll check that gem now
[05:08:24] sandstrom: has joined #ruby
[05:18:42] absolutejam1: has joined #ruby
[05:19:00] sarink: has joined #ruby
[05:19:20] zenspider: has joined #ruby
[05:20:59] sarink_: has joined #ruby
[05:21:09] queip: has joined #ruby
[05:21:53] conta: has joined #ruby
[05:21:53] planigan: has joined #ruby
[05:28:19] conta: has joined #ruby
[05:30:08] dellavg_: has joined #ruby
[05:36:40] cd: has joined #ruby
[05:51:02] sarink: has joined #ruby
[05:51:14] Nilium: has joined #ruby
[05:51:16] fphilipe: has joined #ruby
[05:51:37] havenwood: has joined #ruby
[05:51:38] havenwood: has joined #ruby
[05:51:55] zacts: has joined #ruby
[05:53:13] snowy: has joined #ruby
[05:58:02] sarink: has joined #ruby
[05:59:59] schne1der: has joined #ruby
[06:01:28] xco: has joined #ruby
[06:02:50] m27frogy: has joined #ruby
[06:08:16] jenrzzz: has joined #ruby
[06:10:47] sarink_: has joined #ruby
[06:12:11] absolutejam1: has joined #ruby
[06:26:45] suukim: has joined #ruby
[06:30:54] sarink: has joined #ruby
[06:32:44] conta: has joined #ruby
[06:35:50] lxsameer: has joined #ruby
[06:47:08] chalkmonster: has joined #ruby
[06:47:49] lepepe: has joined #ruby
[06:49:01] salvor: has joined #ruby
[06:50:36] S007: has joined #ruby
[06:51:14] andikr: has joined #ruby
[06:53:08] TomyWork: has joined #ruby
[06:54:35] fphilipe: has joined #ruby
[06:58:56] sarink: has joined #ruby
[07:01:41] jenrzzz: has joined #ruby
[07:03:10] m27frogy: has joined #ruby
[07:04:21] schne1der: has joined #ruby
[07:11:56] lepepe: has joined #ruby
[07:19:38] jidar: has joined #ruby
[07:19:52] ssriram: has joined #ruby
[07:25:45] lepepe: has joined #ruby
[07:33:08] reber: has joined #ruby
[07:33:28] schne1der: has joined #ruby
[07:38:59] snowy: has joined #ruby
[07:44:04] deepreds1: has joined #ruby
[07:44:45] tuor: has joined #ruby
[07:48:56] Megamos: has joined #ruby
[07:49:24] mayurvpatil: has joined #ruby
[07:51:34] jmcgnh: has joined #ruby
[07:54:02] absolutejam1: has joined #ruby
[07:57:44] lepepe: has joined #ruby
[07:58:14] Dbugger: has joined #ruby
[08:00:30] bjpenn: has joined #ruby
[08:04:25] chalkmonster: has joined #ruby
[08:04:42] sarink: has joined #ruby
[08:05:37] queip: has joined #ruby
[08:06:05] conta: has joined #ruby
[08:09:10] johnny56: has joined #ruby
[08:15:37] BH23: has joined #ruby
[08:25:03] alem0lars: has joined #ruby
[08:30:00] absolutejam2: has joined #ruby
[08:35:54] queip: has joined #ruby
[08:35:58] akem-hp: has joined #ruby
[08:36:22] olspookishmagus: has joined #ruby
[08:36:36] sarink: has joined #ruby
[08:39:13] alem0lars: has joined #ruby
[08:39:45] sandstrom: has joined #ruby
[08:40:13] aupadhye: has joined #ruby
[08:41:31] bjpenn: has joined #ruby
[08:43:12] akem-lnvo: has joined #ruby
[08:46:18] jefffrails35: has joined #ruby
[08:47:26] queip: has joined #ruby
[09:01:28] andikr: has joined #ruby
[09:03:41] dtzuzu: has joined #ruby
[09:09:14] sandstrom: has joined #ruby
[09:09:34] sarink: has joined #ruby
[09:13:37] sarink: has joined #ruby
[09:15:56] absolutejam2: has joined #ruby
[09:17:20] jenrzzz: has joined #ruby
[09:22:20] sarink: has joined #ruby
[09:28:52] Nicmavr: has joined #ruby
[09:38:35] lepepe: has joined #ruby
[09:43:21] conta: has joined #ruby
[09:45:25] vondruch: has joined #ruby
[09:49:40] Nilium: has joined #ruby
[09:54:56] sarink: has joined #ruby
[09:57:43] sarink: has joined #ruby
[09:59:45] sarink: has joined #ruby
[10:01:56] queip: has joined #ruby
[10:04:28] Nilium: has joined #ruby
[10:08:07] havenwood: has joined #ruby
[10:08:08] havenwood: has joined #ruby
[10:08:55] conta: has joined #ruby
[10:13:07] Nilium: has joined #ruby
[10:18:34] xtsee: has joined #ruby
[10:30:20] havenwood: has joined #ruby
[10:30:20] havenwood: has joined #ruby
[10:31:35] Nilium_: has joined #ruby
[10:32:11] vondruch: has joined #ruby
[10:35:46] xtsee: has joined #ruby
[10:42:59] evdubs: has joined #ruby
[10:43:46] andikr: has joined #ruby
[10:58:52] lepepe: has joined #ruby
[11:01:52] mcgeeio: has joined #ruby
[11:03:36] mcgeeio: has left #ruby: ()
[11:05:13] leitz: has joined #ruby
[11:07:01] mcgee-io: has joined #ruby
[11:09:44] mcgeeio: has joined #ruby
[11:11:56] mcgee-io: has joined #ruby
[11:13:49] queip: has joined #ruby
[11:14:17] mcgee-io: has joined #ruby
[11:14:56] mcgee-io: has left #ruby: ()
[11:15:46] GodFather: has joined #ruby
[11:16:08] troulouliou_div2: has joined #ruby
[11:17:22] ElFerna: has joined #ruby
[11:17:40] jenrzzz: has joined #ruby
[11:34:57] lepepe: has joined #ruby
[11:36:56] kyrylo: has joined #ruby
[11:40:36] sarink: has joined #ruby
[11:46:16] DTZUZO: has joined #ruby
[12:01:00] cyclonis_: has joined #ruby
[12:03:29] Swyper: has joined #ruby
[12:07:00] cyclonis_: has joined #ruby
[12:10:35] Cthulu201: has joined #ruby
[12:21:47] yalue: has joined #ruby
[12:28:45] involans: has joined #ruby
[12:28:55] AJA4350: has joined #ruby
[12:29:44] sphenxes: has joined #ruby
[12:30:55] jefffrails35: has joined #ruby
[12:48:28] GodFather: has joined #ruby
[12:58:56] kurko_: has joined #ruby
[12:59:48] fphilipe: has joined #ruby
[13:01:00] cyclonis: has joined #ruby
[13:03:22] conta1: has joined #ruby
[13:04:05] Swyper: has joined #ruby
[13:08:44] Swyper: has joined #ruby
[13:09:48] fphilipe: has joined #ruby
[13:12:39] Swyper: has joined #ruby
[13:13:01] cyclonis: has joined #ruby
[13:13:14] dviola: has joined #ruby
[13:18:03] jenrzzz: has joined #ruby
[13:19:01] cyclonis: has joined #ruby
[13:23:20] sandstrom: has joined #ruby
[13:24:13] skryking: has joined #ruby
[13:25:01] cyclonis: has joined #ruby
[13:26:38] tf2ftw: has joined #ruby
[13:29:52] Swyper: has joined #ruby
[13:32:00] queip: has joined #ruby
[13:32:13] za1b1tsu: has joined #ruby
[13:36:52] involans: has joined #ruby
[13:37:12] lepepe: has joined #ruby
[13:38:55] alan_w: has joined #ruby
[13:47:25] guest22: has joined #ruby
[13:47:54] andikr: has joined #ruby
[13:48:32] lepepe: has joined #ruby
[13:55:32] Inline: has joined #ruby
[13:57:46] fphilipe: has joined #ruby
[14:07:18] codefriar: has joined #ruby
[14:18:29] envex: has joined #ruby
[14:20:57] involans: has joined #ruby
[14:27:02] Norrin: I have a couple of questions about the syntax in this method definition -- https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-add_reference
[14:27:38] Norrin: 1) when it says **options, is that like variable arguments? casting everything remaining into an "options" hash?
[14:28:49] Norrin: 2) the keys to the hash are symbols? `add_reference(:products, :user, type: :string)` passing "type" as a symbol?
[14:30:15] THE_GFR|WORK: has joined #ruby
[14:31:19] THE_GFR|WORK: hey everyone have a ruby/ruby-on-rails system and I was wondering if anyone here knew of a gem that might give google sheets like saving ability where text typed into specific areas is automatically saved?
[14:34:04] brendan-: has joined #ruby
[14:38:52] cagomez: has joined #ruby
[14:39:10] NL3limin4t0r: Norrin: Have a look at the Methods - Keyword Arguments documentation. http://ruby-doc.org/core-2.6.3/doc/syntax/methods_rdoc.html#label-Keyword+Arguments
[14:39:42] sarink: has joined #ruby
[14:39:57] NL3limin4t0r: If you have still questions after reading it don't be shy to ask.
[14:40:13] akem-lnvo: has joined #ruby
[14:43:56] lucasb: has joined #ruby
[14:44:08] Norrin: thanks! NL3limin4t0r
[14:47:49] NL3limin4t0r: Norrin: In short, the answer to both questions is yes.
[14:48:35] NL3limin4t0r: This syntax also doesn't allow for other keys.
[14:48:50] fphilipe: has joined #ruby
[14:49:00] Esa_: has joined #ruby
[14:49:36] NL3limin4t0r: &>> def hello(**options); p options; end; hello(a: 1)
[14:49:40] rubydoc: # => {:a=>1} (https://carc.in/#/r/77co)
[14:49:50] NL3limin4t0r: &>> def hello(**options); p options; end; hello('a' => 1)
[14:49:51] rubydoc: stderr: -e:2:in `hello': wrong number of arguments (given 1, expected 0) (ArgumentError) (https://carc.in/#/r/77cp)
[14:50:43] Dr_MDMA_MD: has joined #ruby
[14:51:52] NL3limin4t0r: With "other keys" I mean keys other than symbols. See the example above ^ where a string is used as key.
[14:53:02] queip: has joined #ruby
[14:57:28] NL3limin4t0r: THE_GFR|WORK: I know what you mean, but I don't know of any editors of the top of my head. A quick search found me this https://www.quora.com/Which-HTML5-WYSIWYG-editors-have-a-built-in-autosave
[14:58:54] Megamos: has joined #ruby
[15:01:49] akem-lnvo: has joined #ruby
[15:06:13] rippa: has joined #ruby
[15:06:32] sarink: has joined #ruby
[15:12:22] andikr: has joined #ruby
[15:16:21] niceperl: has joined #ruby
[15:18:23] jenrzzz: has joined #ruby
[15:21:27] Esa_: has joined #ruby
[15:23:43] involans: has joined #ruby
[15:23:52] leitz: More storms...drat...
[15:24:50] sandstrom: has joined #ruby
[15:25:47] zacts|pi: has joined #ruby
[15:26:40] GodFather: has joined #ruby
[15:33:27] codefriar: has joined #ruby
[15:34:50] pygmypuppy: has joined #ruby
[15:35:35] m27frogy: has joined #ruby
[15:38:26] lepepe_: has joined #ruby
[15:39:54] codefriar: has joined #ruby
[15:41:05] kurko__: has joined #ruby
[15:44:18] pygmypuppy: has joined #ruby
[15:45:27] jenrzzz: has joined #ruby
[15:49:06] vondruch: has joined #ruby
[15:52:27] schne1der: has joined #ruby
[15:52:44] Norrin: NL3limin4t0r, interesting. why do the keys have to be symbols?
[15:58:33] NL3limin4t0r: Norrin: I don't know exactly why, maybe someone else can tell you. What I do know is that keyword arguments should always be symbols. If you do want to allow string and other types as key simply create an optional positional argument.
[15:59:06] NL3limin4t0r: &>> def hello(options = {}); p options; end; hello('a' => 1)
[15:59:07] rubydoc: # => {"a"=>1} (https://carc.in/#/r/77dc)
[16:05:27] involans: has joined #ruby
[16:07:20] Norrin: 😫 how array captured hashes and keyword arguments look the same at the call site
[16:10:36] Norrin: &>> def test(*options, a: something); p something; end; a=22; test(1,2,3, a: "a string")
[16:10:36] rubydoc: stderr: -e:2:in `test': undefined local variable or method `something' for main:Object (NameError) (https://carc.in/#/r/77ds)
[16:12:00] Norrin: &>> def test(*options, a: nil); p a; end; a=22; test(1,2,3, a: "a string")
[16:12:01] rubydoc: # => "a string" (https://carc.in/#/r/77du)
[16:14:24] Norrin: &>> def test(*options); p options; end; a=22; test(1,2,3, a: "a string")
[16:14:25] rubydoc: # => [1, 2, 3, {:a=>"a string"}] (https://carc.in/#/r/77dx)
[16:15:20] Norrin: &>> def test(*options); p options; end; a=22; test(1,2,3, 22: "a string")
[16:15:20] rubydoc: stderr: -e:2: syntax error, unexpected ':', expecting ')' (https://carc.in/#/r/77dy)
[16:15:43] leftylink: indeed they take on the same form at the call site. as a logical consequence of this, it also means that at the call site, even `:sym => v` is substitutable for `sym: v`
[16:15:52] Norrin: &>> def test(*options); p options; end; a="test"; test(1,2,3, a: "a string")
[16:15:53] rubydoc: # => [1, 2, 3, {:a=>"a string"}] (https://carc.in/#/r/77dz)
[16:15:53] leftylink: &>> def f(a: :adef, b: :bdef) p [a, b] end; f(:a => :world, :b => :world)
[16:15:54] rubydoc: # => [:world, :world] (https://carc.in/#/r/77e0)
[16:16:34] Norrin: keys to hashes have to be symbols?
[16:17:07] Norrin: &>> def test(*options); p options; end; a="test"; test(1,2,3, "string_key": "a string")
[16:17:07] rubydoc: # => [1, 2, 3, {:string_key=>"a string"}] (https://carc.in/#/r/77e1)
[16:17:12] leftylink: keys to hashes can be whatever you want. {5 => 1, ?a => 2} is a hash with a number and a string as keys
[16:17:49] NL3limin4t0r: Norrin: `"string_key":` is still a symbol.
[16:18:04] rubydoc: # => :foo (https://carc.in/#/r/77e2)
[16:19:07] Norrin: ok. so seems the a: b format dictates that it's a symbol
[16:19:20] Norrin: => will allow a different type
[16:19:26] NL3limin4t0r: Only symbols have the `:` shortcut, other keys must alwasy use the arrow (`=>`).
[16:20:07] NL3limin4t0r: &>> { "a": 1, b: 2, "c" => 4, 5 => :d }
[16:20:07] guest22: has joined #ruby
[16:20:08] rubydoc: # => {:a=>1, :b=>2, "c"=>4, 5=>:d} (https://carc.in/#/r/77e3)
[16:20:54] NL3limin4t0r: The reason that you can put quotes it to easily allow otherwise invalid symbols. With for example spaces in them.
[16:21:07] NL3limin4t0r: &>> :"still a symbol"
[16:21:07] rubydoc: # => :"still a symbol" (https://carc.in/#/r/77e4)
[16:21:20] Norrin: &>> def test(*options, a: nil); p a; end; a=22; test(1,2,3, a => "a string")
[16:22:46] mgraf: has joined #ruby
[16:23:19] SeepingN: has joined #ruby
[16:24:09] mgraf: has left #ruby: ()
[16:24:13] Norrin: &>> def test(*options, a: nil); p a; end; a=22; test(1,2,3, a => "a string")
[16:24:35] Norrin: maybe rubydoc is as confused by this as I am
[16:25:50] mgraf: has joined #ruby
[16:26:04] Norrin: &>> def test(*options, a: nil); p a; end; a=22; test(1,2,3, a => "a string", a: "different string")
[16:26:29] Norrin: &>> def test(*options, a: nil); p a; end; a=22; test(1,2,3, a: "different string")
[16:26:32] jaequery: has joined #ruby
[16:27:20] Norrin: &>> p "you're not blocked"
[16:27:21] rubydoc: # => "you're not blocked" (https://carc.in/#/r/77e9)
[16:32:52] tdy4: has joined #ruby
[16:33:39] m27frogy: has joined #ruby
[16:33:55] Guest42592: has joined #ruby
[16:36:23] mgraf: has left #ruby: ()
[16:38:22] orbyt_: has joined #ruby
[16:39:03] absolutejam2: has joined #ruby
[16:40:31] NL3limin4t0r: Norrin: You've inded some of those lines with a single space.
[16:42:52] leftylink: 16:24:16 < Norrin> I&>> def test
[16:43:07] leftylink: as is reasonable, it would only respond if &>> is the firs tthing. it would not work if there is an I before the &
[16:43:27] cow[moo]: has joined #ruby
[16:44:00] Norrin: hmm, had some strange characters there. it's invisible on my screen, except for whitespace
[16:44:13] Norrin: &>> def test(*options, a: nil); p a; end; a=22; test(1,2,3, a => "a string")
[16:44:14] rubydoc: # => nil (https://carc.in/#/r/77eb)
[16:44:38] leftylink: of course that is no different than if it had been 22 => "a string"
[16:45:20] Norrin: &>> def test(*options, a: nil); p options,a; end; a=22; test(1,2,3, a => "a string")
[16:45:21] rubydoc: # => [1, 2, 3, {22=>"a string"}] (https://carc.in/#/r/77ec)
[16:46:35] Norrin: hmm so array capture will capture a hash even when the method accepts keyword arguments, as long as it's in the a => b form instead of the a: b form
[16:48:10] leftylink: the "as long as" does not apply
[16:48:21] leftylink: actually, I guess kind of
[16:48:48] NL3limin4t0r: symbols can also be in that form `:a => 1`
[16:49:44] leftylink: it really does not matter what syntax was used at the call site, as can be seen in the `def f(a: :adef, b: :bdef) p [a, b] end; f(:a => :hello, :b => :world)` example.
[16:49:51] NL3limin4t0r: &>> def test(*options, a: nil); p options,a; end; a=22; test(1,2,3, a => "a string", a: 1)
[16:49:52] rubydoc: stderr: -e:2:in `<main>': non-symbol key in keyword arguments: 22 (ArgumentError) (https://carc.in/#/r/77ed)
[16:50:39] havenwood: Norrin: See this issue for some discussion of the design direction for keyword arguments in Ruby 3: https://bugs.ruby-lang.org/issues/14183
[16:50:46] NL3limin4t0r: ^ You can't provide an mix of keywords and regular arguments, Ruby doesn't understand it.
[16:51:06] NL3limin4t0r: This does work however:
[16:51:18] NL3limin4t0r: &>> def test(*options, a: nil); p options,a; end; a=22; test(1,2,3, {a => "a string"}, a: 1)
[16:51:19] rubydoc: # => [1, 2, 3, {22=>"a string"}] (https://carc.in/#/r/77ee)
[16:51:31] havenwood: &>> RUBY_VERSION
[16:51:32] rubydoc: # => "2.6.0" (https://carc.in/#/r/77ef)
[16:52:16] havenwood: NL3limin4t0r: In 2.6.3: def test(*options, a: nil); p options,a; end; a=22; test(1,2,3, a => "a string", a: 1)
[16:52:31] havenwood: #=> [[1, 2, 3, {22=>"a string"}], 1]
[16:53:29] matheusmoreira: has joined #ruby
[16:53:51] Norrin: NL3limin4t0r interesting. seems like it glued the two together into one hash
[16:54:22] NL3limin4t0r: havenwood: Didn't know that, but it's good to know. I generally only read the x.x.0 patch notes, since those mostly include the new features.
[16:55:57] cow[moo]: has joined #ruby
[16:56:02] Norrin: havenwood interesting
[16:57:36] absolutejam3: has joined #ruby
[17:01:09] havenwood: NL3limin4t0r: Yeah, this is a fairly rare case where a 2.6.0 feature had to be backed out due to unforeseen incompatibility.
[17:03:28] m27frogy: has joined #ruby
[17:04:07] NL3limin4t0r: Which Ruby version was it added? I can't seem to find it in the 2.6.1, 2.6.2 or 2.6.3 change log. I'm not in the mood to walk through the commit log at this time.
[17:04:41] orbyt_: has joined #ruby
[17:05:24] lord4163: has joined #ruby
[17:06:25] THE_GFR|WORK: NL3limin4t0r: thanks!
[17:07:28] THE_GFR|WORK: NL3limin4t0r: I'm looking for a gem that I can put into my ruby project...
[17:10:24] cyclonis: has joined #ruby
[17:10:59] cyclonis: has joined #ruby
[17:11:18] cyclonis: has joined #ruby
[17:11:45] cyclonis: has joined #ruby
[17:22:27] absolutejam3: has joined #ruby
[17:28:49] gix: has joined #ruby
[17:30:16] conta: has joined #ruby
[17:31:40] absolutejam: has joined #ruby
[17:36:47] Norrin: havenwood what feature was removed?
[17:37:33] Norrin: all i can see if an enhancement, distinguishing the hash from the keyword arg
[17:39:16] cyclonis_: has joined #ruby
[17:39:57] havenwood: Norrin: In 2.6.0, a prohibition was added to prevent passing both Symbol and non-Symbol keys at once.
[17:40:36] havenwood: Norrin: After 2.6.1 release, core team decided it needed to be backed out.
[17:41:28] havenwood: Norrin: NL3limin4t0r https://bugs.ruby-lang.org/projects/ruby-trunk/repository/trunk/revisions/67217/diff
[17:42:46] cyclonis: has joined #ruby
[17:43:15] cyclonis: has joined #ruby
[17:49:18] NL3limin4t0r: For some reason I thought that behaviour was present in older versions too. But testing it in 2.4.1 and 2.5.5 it seems to work fine. I have no clue where I got the idea from then. 😅
[17:49:47] bjpenn: has joined #ruby
[17:50:15] cyclonis: has joined #ruby
[17:50:32] cyclonis: has joined #ruby
[17:50:51] cyclonis: has joined #ruby
[17:51:08] cyclonis: has joined #ruby
[17:51:31] conta: has joined #ruby
[17:51:34] cyclonis: has joined #ruby
[17:52:00] cyclonis: has joined #ruby
[17:52:28] cyclonis: has joined #ruby
[17:52:56] cyclonis: has joined #ruby
[17:53:21] cyclonis: has joined #ruby
[17:57:21] queip: has joined #ruby
[18:00:59] cyclonis: has joined #ruby
[18:01:05] Rudd0: has joined #ruby
[18:01:18] cyclonis: has joined #ruby
[18:01:36] cyclonis: has joined #ruby
[18:01:47] kyrylo: has joined #ruby
[18:03:28] cyclonis: has joined #ruby
[18:03:47] cyclonis: has joined #ruby
[18:04:06] cyclonis: has joined #ruby
[18:06:38] cyclonis: has joined #ruby
[18:08:57] kyrylo: has joined #ruby
[18:13:10] brendan-: has joined #ruby
[18:28:31] rafadc: has joined #ruby
[18:31:14] queip: has joined #ruby
[18:42:44] cliluw: has joined #ruby
[18:43:43] Guest42592: has joined #ruby
[18:43:43] jenrzzz: has joined #ruby
[18:48:07] fr3tz0r: has joined #ruby
[18:48:39] akem-lnvo: has joined #ruby
[18:52:23] alem0lars: has joined #ruby
[18:56:22] absolutejam: has joined #ruby
[18:56:55] snickers: has joined #ruby
[18:57:32] Megamos: has joined #ruby
[19:05:08] johnny56: has joined #ruby
[19:10:02] cd: has joined #ruby
[19:10:24] Fusl: has joined #ruby
[19:12:49] Fusl: has joined #ruby
[19:16:56] SeepingN: has joined #ruby
[19:27:27] colechristensen: has joined #ruby
[19:28:19] jaequery: has joined #ruby
[19:33:37] m27frogy: has joined #ruby
[19:43:58] englishm: has joined #ruby
[19:50:05] leitz: has joined #ruby
[19:57:34] orbyt_: has joined #ruby
[19:58:49] cyclonis: has joined #ruby
[20:00:38] colechristensen: has joined #ruby
[20:05:18] reber: has joined #ruby
[20:05:53] johnny56: has joined #ruby
[20:08:41] Nicmavr: has joined #ruby
[20:24:39] code_zombie: has joined #ruby
[20:31:49] ascarter: has joined #ruby
[20:35:38] kyrylo: has joined #ruby
[20:40:42] ElFerna: has joined #ruby
[20:42:31] colechr60: has joined #ruby
[20:50:31] fr3tz0r: I'm trying to use self.text_input in gosu in a seperate class (Input) than my window class (which inherits Gosu::Window). I passed a reference to an instance of the window to the Input class and call window.text_input but get undefined method text_input, Why?
[20:55:39] ljarvis: has joined #ruby
[20:56:25] jonarrien: has joined #ruby
[20:56:52] psilly0: has joined #ruby
[20:59:25] psilly0: has joined #ruby
[20:59:51] tf2ftw: has joined #ruby
[21:00:42] ur5us: has joined #ruby
[21:02:17] aaron: has joined #ruby
[21:03:18] jaequery: has joined #ruby
[21:05:39] LtHummus: has joined #ruby
[21:07:29] Xeago_: has joined #ruby
[21:10:23] ElFerna: has joined #ruby
[21:14:53] queip: has joined #ruby
[21:20:37] xco: has joined #ruby
[21:23:31] CCDelivery: has joined #ruby
[21:24:31] mozzarella: has joined #ruby
[21:26:43] lxsameer: has joined #ruby
[21:37:53] colechristensen: has joined #ruby
[21:49:31] lepepe: has joined #ruby
[21:50:23] ascarter: has joined #ruby
[21:51:54] kurko_: has joined #ruby
[21:55:27] cliluw: has joined #ruby
[21:58:17] cliluw: has joined #ruby
[22:01:10] ascarter_: has joined #ruby
[22:01:44] cliluw: has joined #ruby
[22:04:53] psilly0: has joined #ruby
[22:17:09] queip: has joined #ruby
[22:20:57] jenrzzz: has joined #ruby
[22:21:18] TomyLobo: has joined #ruby
[22:27:55] lepepe: has joined #ruby
[22:34:40] ellcs: has joined #ruby
[22:35:44] ellcs: has joined #ruby
[22:42:26] sarink: has joined #ruby
[22:43:08] akem_lnvo: has joined #ruby
[22:52:45] BTRE: has joined #ruby
[23:00:19] CCDelivery_: has joined #ruby
[23:04:01] lepepe: has joined #ruby
[23:14:23] colechristensen: has joined #ruby
[23:38:13] fr3tz0r: any ideas?
[23:46:12] colechr94: has joined #ruby
[23:46:33] unreal: has joined #ruby
[23:52:51] orbyt_: has joined #ruby
[23:53:04] kurko_: has joined #ruby
[23:55:05] adam12: fr3tz0r: Can you share some code?
[23:59:56] lepepe: has joined #ruby