<adam12>
It's not the same but might get you close.
<adam12>
Two alternatives (outside of typhoeus) is `down` and `httpx`.
BazzaBazaa has quit [Remote host closed the connection]
Thanzex3268 is now known as Thanzex
markong has joined #ruby
BazzaBazaa has joined #ruby
rvalue has quit [Ping timeout: 240 seconds]
rvalue has joined #ruby
<isene>
How do I extend a method in a class? (I want to extend the method "new" in the Curses class.
<isene>
)
caedmon has joined #ruby
drainpipe has joined #ruby
drainpipe has quit [Client Quit]
caedmon has quit [Ping timeout: 265 seconds]
caedmon has joined #ruby
BazzaBazaa has quit [Remote host closed the connection]
<sarna>
isene: you can either inherit and override initialize in the child class, or you can reopen the class
<sarna>
`.new` is a bit weird though because it's a constructor, I'm not sure how reliable monkey-patching would be here
dviola has quit [Ping timeout: 240 seconds]
BazzaBazaa has joined #ruby
taupiqueur_shiny has quit [Remote host closed the connection]
taupiqueur_shiny has joined #ruby
brokkoli_origin has quit [Ping timeout: 240 seconds]
<TomyWork>
I'm having trouble getting nokogiri to work with a document that contains a default namespace (xmlns=...). Basically this gives me an empty array: Nokogiri::XML('<foo xmlns="http://bar">').xpath('//foo')
<TomyWork>
has anyone ever gotten that to work?
<TomyWork>
ok apparently there is doc.remove_namespaces!, but that's not a great solution. nokogiri ought to match foo regardless of if there's a default namespace on it or not
brokkoli_origin has joined #ruby
<Hess>
hey TomyWork this sounds intriguing. whenever you have time, if you don't mind, please share a gist so I can try to reproduce and have fun with it too
John_Ivan has joined #ruby
dviola has joined #ruby
eddof13 has joined #ruby
<TomyWork>
well it's up there in my first msg :)
idiocrash has joined #ruby
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
BazzaBazaa has quit [Remote host closed the connection]
<gr33n7007h>
TomyWork: xpath doesn't look in namespaces iirc, you'd have to do xpath('//xmlns:foo') or reference it like xpath('//ns1:foo', ns1: "http://bar")
eddof13 has joined #ruby
brokkoli_origin has quit [Ping timeout: 240 seconds]
_ht has joined #ruby
brokkoli_origin has joined #ruby
idiocrash has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<adam12>
havenwood: I could have swore that was accepted :| I wanted to use it somewhere as well and instead had to to_s.split("::")..whatever.
<isene>
sarna: code example?
moldorcoder7 has quit [Ping timeout: 246 seconds]
taupiqueur_shiny has quit [Remote host closed the connection]
keypresser86 has joined #ruby
<TomyWork>
gr33n7007h, what, why is "xmlns:" needed? why does it even work?
<adam12>
Looks like I have the Github redesign enabled now. Interesting.
<TomyWork>
gr33n7007h, https://www.freeformatter.com/xpath-tester.html is perfectly happy with "//foo" and if I try "//xmlns:foo", I get the error "Unable to perform XPath operation. Namespace prefix 'xmlns' has not been declared".
<TomyWork>
you know, as it should
<TomyWork>
so nokogiri is the odd one out here
roadie has joined #ruby
<TomyWork>
on this page, "//xmlns:foo" doesn't throw an error, but it also doesn't match anything: http://xpather.com/3LH70mjy
<ox1eef_>
adam12: Nice, right ? Except maybe the Pull Request view.
<TomyWork>
so it's safe to conclude "//xmlns:foo" is non-standard. "//foo" is spotty too, though.
<adam12>
ox1eef_: Yeah, not too shabyy. Kind of reminds me of a 2009 Github.
<ox1eef_>
We can dream!
taupiqueur_shiny has joined #ruby
EvanR_ has joined #ruby
EvanR has quit [Read error: Connection reset by peer]
taupiqueur_shiny has quit [Ping timeout: 246 seconds]
EvanR_ is now known as EvanR
gh0st6 has joined #ruby
caedmon has quit [Ping timeout: 252 seconds]
markong has quit [Ping timeout: 255 seconds]
caedmon has joined #ruby
<ox1eef_>
Has anyone attempted a monorepo with Ruby before ?
introom has quit [Quit: WeeChat 3.7.1]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
introom has joined #ruby
roshanavand has quit [Ping timeout: 246 seconds]
victori has joined #ruby
eddof13 has joined #ruby
eddof13 has quit [Client Quit]
reset has joined #ruby
<adam12>
ox1eef_: Library or application?
<adam12>
ox1eef_: I guess I've used monorepo for both. I'm currently exploring it for my framework library, and I have a bunch of applications that use a mono repo.
<adam12>
ox1eef_: I like the idea of the monorepo for the framework library tho I question how it will be in practice. I'm not the first to do it this way tho (see padrino, rails, merb, and others). It's nice cutting a single release version and having issues centralized. I find the hanami approach nicer to use for consuming independent libraries but harder
<adam12>
as a maintainer to keep up with everything.
candlestick has joined #ruby
<adam12>
ox1eef_: I have a monorepo with ruby+go, and it works fine, but I dislike how complex the CI/etc is. A lot of times, we just throw up our hands and run everything for every commit, even if nothing changed. Could be just a "holding it wrong" scenario, but it might be nice to have split it to isolate the tooling better.
candlestick has left #ruby [#ruby]
TomyWork has quit [Remote host closed the connection]
eddof13 has joined #ruby
adam12 has quit [Quit: Ping timeout (120 seconds)]
<leftylink>
pandabot: rb (1..100).select { begin eval(?. * _1 + ?1); rescue SyntaxError; end }
<ruser>
hello, i'm looking to get started on ruby (i program in other things) 1. what are some recommended IDE's, 2. are there linters available that will satisfy a style guide(3?), and some best practices (4?). 5.What does a typical ruby pipeline looks like? I'm looking to write a toy project scrape RSS, store in some db back end (6. what are popular db choices?) and expose some API.
<weaksauce>
vscode with some extensions is good. rubymine is a paid one and it's more like a full ide
<havenwood>
ruser: 1. VS Code is more of a text editor but it's popular. RubyMine is an IDE with more of a Rails focus. 2. Rubocop is the typical linter. You can run `rubocop -A` to auto format. 3. Rubocop comes with a corresponding style guide and best practices. 5. Capistrano or Mina are deployment tools or many folk just have some sort of git hook when they
<havenwood>
push that automatically deploys either on their server or a service. 6. Postgres is probably the most popular but plenty of folk use SQLite or MariaDB. Redis is usually used as an in-memory store.
Argorok has quit [Quit: Connection closed for inactivity]
<havenwood>
I look forward to Surreal DB support in Ruby, though we can already use the REST interface.
<weaksauce>
i would say standard ruby is probably more what you'd want but it uses rubocop in the backend
<havenwood>
weaksauce: I'd just back off the Rubocop nutty line, method and class length stuff.
<havenwood>
Otherwise its defaults are sane. I don't likes spaces inside my hashes, but can't win em all.
<weaksauce>
havenwood yeah but a complete beginner might want to just have all those things taken care of
<havenwood>
weaksauce: The Rubocop defaults are more beginner oriented it seems to me.
<havenwood>
The suggestions around method length, etc, are really for that audience.
<havenwood>
weaksauce: But yeah, standardrb would be fine too. Cracks me up we can't just adjust Rubocop defaults, but what do you do?! ¯\_(ツ)_/¯
<havenwood>
Ruby should ship with a minimalist `ruby format` linter on the subset we all agree on.
<havenwood>
I've floated it and at least a couple Ruby Core members agree.
<weaksauce>
i am fully on board havenwood
<ruser>
Appreciate the answers. What makes Rubocop more begginer friendly? Sane messages? Forgiving with style? If the latter, I'd prefer something stricter
<havenwood>
Rubocop deps are currently too much for stdlib.
<weaksauce>
make it happen
<weaksauce>
*let's
<havenwood>
ruser: It's length suggestions are aimed at getting folk to break up unnecessary cyclomatic complexity.
<havenwood>
More advanced users already do that and tend to just trigger the warnings when things are *actually* complex.
<havenwood>
So folk back them off or ignore them. They don't autocorrect.
<ruser>
oh, that seems reasonable to me (reducing numbers of execution paths)
<havenwood>
My `.rubocop.yml` file, FWIW:
<havenwood>
AllCops:
<havenwood>
TargetRubyVersion: 3.2
<havenwood>
NewCops: enable
<havenwood>
EnforcedStyle: no_space
<havenwood>
Layout/SpaceInsideHashLiteralBraces:
<havenwood>
Basically, ^ check all the things and don't put spaces inside my Hashes!
<havenwood>
I just ignore warnings about length, typically, unless I'm in an actual project.
<havenwood>
In which case I disable them.
<havenwood>
weaksauce: yeah, i think it'd be very much a win for Ruby to gain a `format` command. :)
<havenwood>
Eregon and some others were favorable.
<ruser>
oh, also, what are good practices areound unit test in ruby? framework recomendations?
<havenwood>
ruser: The two big ones are Minitest and RSpec. The former ships with Ruby.
<ruser>
thank you
<havenwood>
ruser: 🙌
<weaksauce>
ruser welcome!
<ruser>
did i miss anything? :)
taupiqueur_shiny has joined #ruby
<ruser>
Oh, just reading the lan page java->ruby identity vs equality gotcha :)
caedmon has quit [Ping timeout: 240 seconds]
taupiqueur_shiny has quit [Ping timeout: 246 seconds]
infinityfye has quit [Quit: Leaving]
EvanR has quit [Read error: Connection reset by peer]
EvanR has joined #ruby
CalimeroTeknik has quit [Changing host]
CalimeroTeknik has joined #ruby
dostoyevsky2 has quit [Server closed connection]
dostoyevsky2 has joined #ruby
<ruser>
do gems get installed in user space?
<leftylink>
if using the flag --user-install for gem
<leftylink>
oh, running as a user, it is doing that by default anyway
<leftylink>
so I instead need to change my answer to something "as long as you don't pass the flag --no-user-install"
<ruser>
running from userspace it's still trying to install into `/var/lib/gems/3.0.0/cache/
* John_Ivan
is sad
<adam12>
They've been trying to make that the default for a while but not much luck.
<ruser>
thought this is listed in gem path - /home/user/.local/share/gem/ruby/3.0.0
<leftylink>
guess my gem install has different default behaviour. I wonder what configures that default. was it compiled in or is there a config file
<adam12>
leftylink: Fedora has patches to make it the default.
<adam12>
(if you're using Fedora)
<John_Ivan>
hey adam12.
<ruser>
i'm on Ubuntu 22.04.2 LTS
<leftylink>
I see that my install of ruby also placed this /etc/gemrc that includes thie line: "gem: --user-install"
<leftylink>
that must be what makes it the default for me
<John_Ivan>
bit of a non-ruby question here. what package manager does your distro have?
<adam12>
John_Ivan: I use Debian almost 100% of the time so I use apt.
<adam12>
I have a handful of Almalinux machines using dnf/yum.
<leftylink>
I just used the default package manager, I never really looked into any alternatives
<ruser>
apt here as well
<John_Ivan>
how can you guys stand apt? or do you barely install anything on the machine?
<John_Ivan>
my experience has been that it's the worst package manager of out everything I've ever tried.
<adam12>
John_Ivan: I never run into issues.
<John_Ivan>
well, for one, apt doesn't do verification after installation. and it's easier to break dependency trees due to a lack of a sophisticated SAT solver
<John_Ivan>
I've had the WORST problems with apt and I find it strange how people rely so much on it, unless, as I said, I probably do niche stuff and install/uninstall/tweak around more often than the average user
<John_Ivan>
which would explain why everyone else isn't bothered by it.
<ruser>
adam12: yeah, that will solve it, but it I don't know why would I want packages systemwide. I'd be a lot happier with userspace.
<leftylink>
I wonder what are the advantages and disadvantages of blog author choosing to do it this way instead of with gemrc "gem: --user-install"
_ht has quit [Quit: _ht]
<adam12>
leftylink: Likely just keeping everything in one place, since this sets PATH too.
<adam12>
I ran across it for something else, but can't help it's super handy for people coming here looking to just run Jekyll. We always start with a ruby version manager and a bunch of other stuff, but unless they are on RHEL7 (ruby 2.0.0 :\ ), they could possibly get away with system ruby to start.
<adam12>
ruser: --user-install is user-space but global for your user. If that's no good, you can set your own GEM_HOME and GEM_PATh.
<ruser>
thank you adam12 i should have looked at that page you linked, thank you
<ruser>
well that's interesting: >Gem allows you to install packages to your own user directory using the --user-install option but it doesn’t add the directory of these ‘user’ packages to your $PATH. Meaning that its pretty much unusable.
<ruser>
apparently the linked github issue is still listed as open :)
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
EvanR_ has joined #ruby
caedmon has joined #ruby
EvanR has quit [Ping timeout: 260 seconds]
caedmon has quit [Ping timeout: 240 seconds]
Sankalp has quit [Ping timeout: 260 seconds]
Sankalp has joined #ruby
EvanR has joined #ruby
EvanR_ has quit [Read error: Connection reset by peer]
roadie has quit [Ping timeout: 240 seconds]
eddof13 has quit [Ping timeout: 256 seconds]
<ox1eef_>
ruser: Set $GEM_HOME, and $GEM_PATH to $HOME/.gems. Afterwards, 'gem install foo' will install foo to $HOME/.gems.
taupiqueur_shiny has joined #ruby
<ox1eef_>
For bin support, add $HOME/.gems/bin to the end of $PATH.
taupiqueur_shiny has quit [Ping timeout: 246 seconds]
otisolsen70 has quit [Quit: Leaving]
bambanxx has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
bambanxx has joined #ruby
Munto has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
tomtmym has quit [Quit: Gone.]
roadie has joined #ruby
<ruser>
ox1eef_: thnx
markong has joined #ruby
roadie has quit [Ping timeout: 240 seconds]
EvanR_ has joined #ruby
EvanR has quit [Ping timeout: 240 seconds]
roadie has joined #ruby
dviola has left #ruby [WeeChat 3.8]
ua_ has quit [Ping timeout: 240 seconds]
dviola has joined #ruby
roadie has quit [Ping timeout: 240 seconds]
<havenwood>
Or the start of path, if there are other Rubies you might want to be stomping on.
ap4y has joined #ruby
ua_ has joined #ruby
xuochi_ has joined #ruby
<ox1eef_>
Unless there's a good reason, I think the end of the $PATH is preferable. Carries less risk that $HOME/bin might take precendence over a system utility.