jhass[m] changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.1.2, 3.0.4, 2.7.6: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
TCZ has quit [Quit: ...]
ralu1 has quit [Ping timeout: 240 seconds]
AndreYuhai has joined #ruby
AndreYuhai has quit [Ping timeout: 246 seconds]
dka has quit [Quit: My Ex-Girlfriend once told me: I'm not a slut, I'm just popular]
dka has joined #ruby
ralu1 has joined #ruby
John_Ivan_ has quit [Ping timeout: 250 seconds]
sgt_chuckles has quit [Quit: Client closed]
Rounin has quit [Ping timeout: 240 seconds]
kenichi_ has quit [Quit: ZNC 1.8.2 - https://znc.in]
kenichi has joined #ruby
victori has quit [Quit: ZNC 1.8.2 - https://znc.in]
victori has joined #ruby
AndreYuhai has joined #ruby
Ziyan has joined #ruby
AndreYuhai has quit [Ping timeout: 256 seconds]
hanzo has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Guest89 has joined #ruby
Glue has joined #ruby
Guest89 has quit [Quit: Client closed]
<Glue> Hi all.  Just a curiosity that has been bugging me:  Is there any way to wrap a section of code in such a way that I could output the result of each line like a repl would without prefixing every line with p/puts/whatever?  My understanding says there isn't, but it just seems like a neat trick to know if there is.
AndreYuhai has joined #ruby
AndreYuhai has quit [Ping timeout: 276 seconds]
hololeap has quit [Remote host closed the connection]
hanzo has quit [Quit: Connection closed for inactivity]
hololeap has joined #ruby
AndreYuhai has joined #ruby
Ziyan has quit [Quit: Textual IRC Client: www.textualapp.com]
AndreYuhai has quit [Ping timeout: 240 seconds]
<ox1eef> Glue: pry does this, type pry file.rb - at the end it lands you in a pry session.
_ht has joined #ruby
<ox1eef> my bad, it seems pry does not that feature (anymore i guess)
ruby-eval has quit [Ping timeout: 250 seconds]
_ht has quit [Remote host closed the connection]
Glue has quit [Ping timeout: 252 seconds]
AndreYuhai has joined #ruby
some14u has joined #ruby
Rounin has joined #ruby
oxfuxxx has joined #ruby
jpn has joined #ruby
hololeap has quit [Remote host closed the connection]
mahlon has quit [Ping timeout: 252 seconds]
ged has quit [Ping timeout: 260 seconds]
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jpn has quit [Ping timeout: 276 seconds]
some14u has joined #ruby
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
some14u has joined #ruby
duderonomy has joined #ruby
jpn has joined #ruby
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ox1eef> the feature im thinking of is the "play" command, you gotta be in the Pry repl to run it.
dionysus69 has joined #ruby
<ox1eef> ok go ahead
<ox1eef> whats the problem
<ox1eef> nvm that
some14u has joined #ruby
some14u has quit [Client Quit]
jpn has quit [Quit: leaving]
some14u has joined #ruby
jpn has joined #ruby
some14u has quit [Client Quit]
ssh073 has quit [Remote host closed the connection]
ssh073 has joined #ruby
oxfuxxx has quit [Quit: [H]EAT ROX FUCK R0X SHIT BRIX. = The Yankies M0th3Rphackers Coconut Aerospace =]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gcd has quit [Remote host closed the connection]
AndreYuh2i has joined #ruby
AndreYuh2i has quit [Client Quit]
AndreYuh2i has joined #ruby
<AndreYuh2i> How can I make an XHR request in a test?
<ox1eef> one makes a XHR request using XMLHttpRequest on the client side using javascript, to the server-side it is just another request.
Ziyan has joined #ruby
<AndreYuh2i> ox1eef: So on the backend we're just making a JS request with format: :js to test something however we receive InvalidCrossOriginRequest, however that just works fine on the environment we have.
<AndreYuh2i> Does that mean there's something wrong with the test config? Like I don't know what the origin of that request would be.
TomyWork has joined #ruby
Ziyan has quit [Quit: Textual IRC Client: www.textualapp.com]
ssh073 has quit [Ping timeout: 240 seconds]
John_Ivan_ has joined #ruby
oxfuxxx has joined #ruby
protektwar has quit [Remote host closed the connection]
Sheilong has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
<ox1eef> okay, then you make a request to /foo/bar.js - are you returning javascript from that endpoint? if so then good, if not it doesn't make sense. your spec or test should make a request something like, get :bar, params: {format: :js} - at this point you can test the response.
shiru has joined #ruby
<ox1eef> you shouldn't receive that error, is it in your tests alone? if so then you're probably missing a header or something like that.
<ox1eef> a CORS header*
sylario has joined #ruby
<AndreYuhai> ox1eef: Sorry for the delay, yes it's only in the test.
<AndreYuhai> ox1eef: I think I am missing the host but I wonder why the host would be different in this case.
<AndreYuhai> And the endpoint returns a javascript that's correct.
AndreYuh2i has quit [Quit: Lost terminal]
shiru has quit [Quit: Lost terminal]
perrierjouet has quit [Ping timeout: 240 seconds]
<ox1eef> look into setting the Origin header for the test
John_Ivan has joined #ruby
John_Ivan_ has quit [Ping timeout: 256 seconds]
some14u has joined #ruby
szkl has joined #ruby
<AndreYuhai> ox1eef: Thank you, will do! By the way, how can I print out the request headers in controller in Ruby? It's been a while since I used Ruby so I don't remember how to do that. :D
<AndreYuhai> request.headers I guess
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ox1eef> is this Rails? i think request.env includes them.
<AndreYuhai> Yes, it is
<ox1eef> ok, then nevermind, i think request.headers works best
jpn has quit [Ping timeout: 276 seconds]
<AndreYuhai> Is there a `format: :js` option for the GET request? I see it in code but I don't know whether that has any purpose :D Also couldn't find anything like that in docs. https://apidock.com/rails/ActionController/TestCase/Behavior/get
<ox1eef> the format is just a parameter that's part of the path... something like, /foo/bar.(:format) - so you should pass it like a param.
jpn has joined #ruby
<AndreYuhai> ox1eef: so it should be inside the params hash right? But I figured even if I deleted it, it just works.
<AndreYuhai> To overcome the issue I just needed to add "xhr: true" to the get request
<adam12> Morning
<AndreYuhai> Then everything was fine and somehow I don't need to mention format: :js
<AndreYuhai> o/
<ox1eef> AndreYuhai: that's right, add it to the 'params' hash. i have never heard of the 'xhr' option, so no idea what that does.
<ox1eef> good morning adam12
<adam12> ox1eef: Morning! Happy Friday!
<ox1eef> same to you :)
<AndreYuhai> ox1eef: it just adds some other headers like "HTTP_X_REQUESTED_WITH"=>"XMLHttpRequest", "HTTP_ACCEPT"=>"text/javascript, text/html, application/xml, text/xml, */*" at least that was the difference
<AndreYuhai> Where do you actually check when you want to see the docs I am wondering? do you usually use apidock.com?
<ox1eef> for Rails-specific stuff? i usually just google.
<adam12> apidock.com is the worst, IMHO
<adam12> If it's Rails, use their merged sdoc. api.rubyonrails.org
<adam12> If it's for Ruby, use either official docs docs.ruby-lang.org or rubyapi.org
<AndreYuhai> adam12: apidock sometimes is useful but for some methods I just couldn't find what I wanted. :D
<ox1eef> the documentation situation in ruby is depressing.
<adam12> ox1eef: 100%. It's all I can think about lately.
<adam12> I wonder who's doing it best (outside of Ruby).
some14u has joined #ruby
<adam12> I feel like Elixir has reasonably good docs.
<AndreYuhai> I've been coding in Elixir for a few months and I love the documentation there :D
<adam12> They are using a Markdown variant.
<AndreYuhai> Since I've not been using Ruby lately I just couldn't find what I wanted.
<adam12> (GFM + some other bits)
<ox1eef> yard does a pretty good job, i find it to be the best of the bunch but still not perfect. it has really nice features like @group, for categorizing your methods. on the other hand, it has things that annoy me - like alphabetically sorting methods, instead of showing them in the order they appear in the source.
<adam12> AndreYuhai: Do you remember if Elixir has a command line doc tool? I only see HTML and Pandoc in ex_doc.
<adam12> AndreYuhai: like Ruby's `ri`.
<ox1eef> Elixir and Ruby are not that different syntax-wise.
<adam12> I'd hate to introduce another doc tool, but I was thinking about it this morning and wonder what the MVP of docs is.
<AndreYuhai> adam12: yes, you can use "h" https://hexdocs.pm/iex/1.12/IEx.Helpers.html#h/1
<adam12> rdoc auto-links classes/modules (or what it believes are classes/modules), which I think is a mistake.
protektwar has quit [Remote host closed the connection]
<adam12> AndreYuhai: Right. `irb` has that too, interesting enough, but it's `help`. And I'm not even sure it's documented.
<adam12> But it loads `ri`. So if you're using YARD, it's not a great experience.
<adam12> And I've never been able to get `yri` to work.
<ox1eef> adam12: don't start from scratch, it is a huge effort - i'd consider forking yard, and fixing the things you dislike. i'm already in that process when it comes to the default template.
<adam12> And due to backwards compatibility, `yard` drives me nuts wrt. command line args.
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
some14u has quit [Ping timeout: 240 seconds]
<adam12> I feel like everyone is thinking about it lately. I saw ioquatix open an issue on rdoc about support @param and @return tags. He built his own documentation tool as well. https://github.com/ioquatix/decode
<AndreYuhai> If you have an accept header with "HTTP_ACCEPT"=>"text/javascript, text/html, application/xml, text/xml, */*" then do you need to specificy the `format: :js` in get method still? I mean you don't need to but I just wanted to make sure that's because of the header? :D
<adam12> That's a wild HTTP_ACCEPT.
<AndreYuhai> adam12: that's just in test, and it happens when I do "xhr: true"
<AndreYuhai> And there's no mention of that option in docs, I have no idea how that works
<AndreYuhai> At least in get method, maybe it's described in some general topic
<AndreYuhai> With xhr: true, I just saw that there were additional headers added like the ACCEPT one and X-Requested-With
<leftylink> anya
some14u has joined #ruby
Ziyan has joined #ruby
some14u has quit [Ping timeout: 248 seconds]
John_Ivan has quit [Read error: Connection reset by peer]
John_Ivan has joined #ruby
AndreYuhai has quit [Ping timeout: 240 seconds]
kaleido has quit [Quit: peas]
kaleido has joined #ruby
John_Ivan has quit [Quit: Leaving]
kaleido has quit [Remote host closed the connection]
kaleido has joined #ruby
bit4bit has joined #ruby
_ht has joined #ruby
sgt_chuckles has joined #ruby
John_Ivan has joined #ruby
protektwar has quit [Remote host closed the connection]
<sgt_chuckles> I'm trying to verify a hash in rspec which contains an array of hashes, and wondering how to do so since my test keeps failing: https://www.toptal.com/developers/hastebin/uxakasocov.sql
protektwar has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
AndreYuhai has joined #ruby
bit4bit has quit [Ping timeout: 256 seconds]
AndreYuhai has quit [Ping timeout: 272 seconds]
<Rounin> sgt_chuckles: Well, all of the code is missing, and the error message, so it's a bit hard to guess
<Rounin> For one thing, "endpoint" and "client_id" are undefined, and expect is probably undefined, etc.
tuxcrafter has joined #ruby
<sgt_chuckles> thats just one case
<sgt_chuckles> ok
<sgt_chuckles> full code
<sgt_chuckles> only the first case fails
<sgt_chuckles> it expects a different result, when the results match exactly
<Rounin> Well, again, it seems to be missing the entire thing that it's testing... But never mind that... What error message is it giving you?
tuxcrafter has quit [Quit: Client closed]
tuxcrafter has joined #ruby
<Rounin> Ah... Right... So on one end, it says "kty": "RSA", and on the other it says random stuff
<Rounin> And also, the one that doesn't have random stuff in "kty" has it in "n"
<Rounin> I guess "kty" is "key type"? So the one with key type "tons of random stuff" is probably not right
AndreYuhai has joined #ruby
<ox1eef> mooff: it took a while, but i got around to thanking you :) https://0x1eef.github.io/x/ryo.rb/#thanks
<nebiros> at rails, somebody knows why when I do Something.new the created_at is nil?
<nebiros> doing this: something = Something.new(); something.transaction {call_to_other_inserts}
<nebiros> but created_at at `something` is nil
<nebiros> :|
AndreYuhai has quit [Ping timeout: 276 seconds]
tuxcrafter has quit [Ping timeout: 252 seconds]
TCZ has joined #ruby
crundar has joined #ruby
TCZ has quit [Quit: ...]
dionysus69 has quit [Ping timeout: 246 seconds]
Glue has joined #ruby
mahlon has joined #ruby
<Glue> Thanks anyway, ox1eef. Repeating p/puts still works if I need it.  Really I'm just curious about being able to hook into the results of each line within a block rather than only being able to work with what the block returns.  It sounds like generally speaking, there isn't.
<ox1eef> Glue: there is the "play" command in Pry, it can "play" a file: "play foo.rb", trying it though - it has changed, it is not stepping through every line but the final expression. it was not always that way, i am pretty sure.
AndreYuhai has joined #ruby
AndreYuhai has quit [Ping timeout: 246 seconds]
dionysus69 has joined #ruby
bit4bit has joined #ruby
crundar has quit [Quit: Client closed]
duderonomy has joined #ruby
<ox1eef> adam12: i made a couple more improvements to the default yard template. The "Table of contents" on a file like README.md is now sticky, following you when you scroll, and it also hides itself on low res devices (<= 1280px)
dionysus69 has quit [Ping timeout: 240 seconds]
TomyLobo has joined #ruby
TomyWork has quit [Ping timeout: 248 seconds]
bit4bit has quit [Ping timeout: 240 seconds]
tuxcrafter has joined #ruby
AndreYuh1i has joined #ruby
AndreYuh1i has quit [Ping timeout: 276 seconds]
<adam12> ox1eef: Cool.
<weaksauce> planning on doing something with it ox1eef
bit4bit has joined #ruby
roadie` has quit [Quit: ERC (IRC client for Emacs 25.3.50.1)]
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
oxfuxxx has quit [Quit: [H]EAT ROX FUCK R0X SHIT BRIX. = The Yankies M0th3Rphackers Coconut Aerospace =]
<ox1eef> at the moment i'm just copying it between projects, i think eventually i will make its own repo.
<ox1eef> my only other wishes are for the 'module Foo; extend self; end' pattern to be covered, and for 'extend' to be its own thing, right now yard refers to extend as included, i think its really confusing.
AndreYuhai has joined #ruby
<ox1eef> id also prefer 'Class methods' to be described as 'Singleton methods', that's the jargon ruby itself uses, and when yard adds 'Class methods' for what is a module, i dont think it adds up or makes sense.
AndreYuhai has quit [Ping timeout: 246 seconds]
<weaksauce> i wonder if upstream would want that kind of separation
<ox1eef> i'm not sure, probably not, i'm sure there's reason and logic behind why it is like it is now. i just disagree with it on a conceptual level.
<ox1eef> ultimately yard is quite extensible, the changes ive made so far have been made without modifying yard itself.
duderonomy has quit [Quit: Textual IRC Client: www.textualapp.com]
szkl has quit [Quit: Connection closed for inactivity]
ssh073 has joined #ruby
<sgt_chuckles> is there a way to somehow get the curl equavalent of a request i am making via http?
<sgt_chuckles> *equivalent
splud has quit [Ping timeout: 246 seconds]
Ziyan has quit [Quit: Textual IRC Client: www.textualapp.com]
protektwar has quit [Remote host closed the connection]
AndreYuhai has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
<weaksauce> sgt_chuckles there's a plugin for vscode that does that
<weaksauce> but not from ruby though
AndreYuhai has quit [Ping timeout: 276 seconds]
splud has joined #ruby
_ht has quit [Remote host closed the connection]
Vonter has quit [Ping timeout: 246 seconds]
oxfuxxx has joined #ruby
oxfuxxx has quit [Client Quit]
AndreYuhai has joined #ruby
AndreYuhai has quit [Ping timeout: 272 seconds]
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has joined #ruby
protektwar has quit [Changing host]
bit4bit has quit [Ping timeout: 276 seconds]
bit4bit has joined #ruby
AndreYuh1i has joined #ruby
AndreYuh1i has quit [Ping timeout: 272 seconds]
shiru has joined #ruby
legit has quit [Quit: WeeChat 2.8]
sgt_chuckles has quit [Quit: Client closed]
shiru has quit [Quit: leaving]
dionysus69 has joined #ruby
Aylat has joined #ruby
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
weaksauc_ has joined #ruby
weaksauce has quit [Ping timeout: 246 seconds]
dionysus69 has quit [Ping timeout: 240 seconds]
<opv> could you tell me what is the ruby equivalent of a pipfile or a package.json?
<opv> my searches seem to be missing the right keywords
<Glue> opv Like a gemfile?
<opv> thank you
<Glue> you're welcome
Aylat has quit [Quit: Leaving]
Aylat has joined #ruby
Aylat has quit [Changing host]
Aylat has joined #ruby
<weaksauc_> ox1eef i'd be interested in seeing your yard stuff if you ever put it online
AndreYuhai has joined #ruby
AndreYuhai has quit [Ping timeout: 260 seconds]
Aylat has quit [Quit: Leaving]
bit4bit has quit [Quit: Leaving]
some14u has joined #ruby
some14u has quit [Ping timeout: 240 seconds]
protektwar has quit [Remote host closed the connection]
protektwar has joined #ruby
protektwar has quit [Changing host]
protektwar has joined #ruby
AndreYuhai has joined #ruby
robotmay has quit [Quit: No Ping reply in 180 seconds.]
AndreYuhai has quit [Ping timeout: 276 seconds]
robotmay has joined #ruby