havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.7.1, 2.6.6, 2.5.8: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
ur5us has quit [Ping timeout: 260 seconds]
jenrzzz_ has joined #ruby
jenrzzz has quit [Read error: Connection reset by peer]
orbyt_ has joined #ruby
poro has quit [Read error: Connection reset by peer]
poro_ has joined #ruby
duderonomy has quit [Ping timeout: 258 seconds]
<havenwood> xco: #flat_map and #map
<havenwood> xco: data = 1.upto(100).flat_map do
<havenwood> xco: ...(:tag).map do |row|
<havenwood> smccarthy: Lambda requires preselection of gems, afaik. May be a way, but dunno.
oddduck has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duderonomy has joined #ruby
<oddduck> Is there anything like a Resource monad in ruby, maybe from the various dry-* gems? The resource would be constructed with "acquire" and "release" lambdas/blocks. When I bind or fmap, acquire would be run, result passed to function being bound, then release would be run.
<oddduck> Actually I don't think it could be a Monad. But some standard bracket implementation basically that defers execution of acuqire and release until used, and that can be composed with other brackets easily somehow
cnsvc_ has joined #ruby
<xco> havenwood yup!
cnsvc_ has quit [Ping timeout: 240 seconds]
<smccarthy> havenwood: Oh, I got around it before by doing this : gems_lib = "/tmp/#{package}/vendor/bundle/ruby/2.5.0/gems/**/lib" ; load_paths = Dir[gems_lib] ; $LOAD_PATH.unshift(*load_paths) , but this failed for me for concurrent-ruby, since I needed this : $LOAD_PATH.unshift("/tmp/#{package}/vendor/bundle/ruby/2.5.0/gems/concurrent-ruby-1.1.6/lib/concurrent-ruby")
<smccarthy> I was hoping bundler inline would get me away from this hackyness of adding the gems to the $LOAD_PATH
AndreYuhai has quit [Quit: Leaving]
duderonomy has quit [Ping timeout: 256 seconds]
bsdbandit-01 has quit [Ping timeout: 265 seconds]
bsdband8 has joined #ruby
jenrzzz_ has quit [Ping timeout: 246 seconds]
kinduff has quit [Read error: Connection reset by peer]
bruce_lee has quit [Ping timeout: 256 seconds]
bruce_lee has joined #ruby
bruce_lee has joined #ruby
bruce_lee has quit [Changing host]
kinduff has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
duderonomy has joined #ruby
jenrzzz has joined #ruby
oddduck has quit [Remote host closed the connection]
BH23 has quit [Ping timeout: 265 seconds]
Esa__ has quit [Ping timeout: 256 seconds]
BH23 has joined #ruby
poro_ has quit [Ping timeout: 246 seconds]
jenrzzz has quit [Ping timeout: 265 seconds]
<havenwood> oddduck, ah, they left. was going to suggest async and friends like async-io. https://github.com/socketry/async
jenrzzz has joined #ruby
gavlee has quit [Ping timeout: 260 seconds]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
<xco> i'm using my method like this https://gist.github.com/xcobar/5b94a54f53be8fa71061c599366bd761#file-meth-rb-L8 what it does is take an html markup like say <p>hello</p> and return just "hello"
<xco> tried this in irb works alright
<xco> in the script it doesn't inset any rows to the CSV
<xco> #help
troulouliou_dev has quit [Quit: Leaving]
davispuh has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
tau has quit [Ping timeout: 265 seconds]
ChmEarl has quit [Quit: Leaving]
<xco> fixed
jenrzzz has quit [Ping timeout: 272 seconds]
orbyt_ has joined #ruby
gitter1234 has joined #ruby
smccarthy has quit [Remote host closed the connection]
drincruz has quit [Ping timeout: 258 seconds]
jenrzzz has joined #ruby
gix- has joined #ruby
gix has quit [Disconnected by services]
drincruz has joined #ruby
envex has joined #ruby
nbkhope has joined #ruby
drincruz has quit [Ping timeout: 265 seconds]
nbkhope has quit [Client Quit]
jaegarn has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
thebetra2 has quit [Quit: WeeChat 2.2]
jenrzzz has joined #ruby
jenrzzz has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
thebetra1 has joined #ruby
duderonomy has quit [Ping timeout: 240 seconds]
DoloresHaze has joined #ruby
thebetra1 has quit [Quit: WeeChat 2.2]
thebetra1 has joined #ruby
<gitter1234> New concept art for driftingruby.com: https://i.imgur.com/J17KOMC.png - thoughts?
sphex_ has quit [Ping timeout: 240 seconds]
<DoloresHaze> gitter1234: it's nice looking
DoloresHaze has quit [Quit: leaving]
_whitelogger has joined #ruby
drincruz has joined #ruby
drincruz has quit [Ping timeout: 246 seconds]
sauvin has joined #ruby
lesha has quit [Ping timeout: 265 seconds]
jenrzzz has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
lesha has joined #ruby
donofrio__ has quit [Remote host closed the connection]
szqdsegrhrdgdrg has joined #ruby
<szqdsegrhrdgdrg> hi
cliluw has quit [Ping timeout: 260 seconds]
cliluw has joined #ruby
szqdsegrhrdgdrg has quit [Remote host closed the connection]
blackthor has joined #ruby
<blackthor> hello!
shansen has quit [Quit: ZNC 1.7.4+deb0+bionic0 - https://znc.in]
shansen has joined #ruby
cd has quit [Quit: cd]
lesha has quit [Ping timeout: 265 seconds]
imode has quit [Ping timeout: 256 seconds]
drincruz has joined #ruby
drincruz has quit [Ping timeout: 258 seconds]
blackthor has quit [Read error: Connection reset by peer]
blackthor has joined #ruby
reyfi9e has quit [Ping timeout: 260 seconds]
DaniG2k has joined #ruby
dvarrui has joined #ruby
reyfi9e has joined #ruby
jenrzzz has quit [Ping timeout: 265 seconds]
ldepandis has joined #ruby
jaegarn has quit [Quit: Konversation terminated!]
conta has joined #ruby
conta has quit [Remote host closed the connection]
conta has joined #ruby
conta has quit [Remote host closed the connection]
conta has joined #ruby
twe4ked has quit [Ping timeout: 260 seconds]
conta has quit [Remote host closed the connection]
conta has joined #ruby
conta has quit [Remote host closed the connection]
twe4ked has joined #ruby
conta has joined #ruby
conta has quit [Client Quit]
conta has joined #ruby
DaniG2k has quit [Quit: leaving]
conta has quit [Remote host closed the connection]
conta has joined #ruby
FastJack has quit [Ping timeout: 264 seconds]
conta has quit [Remote host closed the connection]
conta has joined #ruby
conta has quit [Remote host closed the connection]
conta has joined #ruby
conta has quit [Remote host closed the connection]
conta has joined #ruby
conta has quit [Client Quit]
FastJack has joined #ruby
cnsvc_ has joined #ruby
dionysus69 has joined #ruby
dvarrui has quit [Remote host closed the connection]
cnsvc_ has quit [Ping timeout: 240 seconds]
universa1 has quit [Quit: ZNC 1.6.1+deb1~ubuntu14.04.0 - http://znc.in]
universa1 has joined #ruby
schne1der has joined #ruby
envex has quit []
cnsvc_ has joined #ruby
jenrzzz has joined #ruby
cnsvc_ has quit [Ping timeout: 240 seconds]
jenrzzz has quit [Ping timeout: 272 seconds]
conta has joined #ruby
conta has quit [Remote host closed the connection]
conta has joined #ruby
ur5us has joined #ruby
conta has quit [Remote host closed the connection]
conta has joined #ruby
prestorium has joined #ruby
cnsvc_ has joined #ruby
conta has quit [Quit: conta]
cnsvc_ has quit [Ping timeout: 240 seconds]
prestorium has quit [Quit: prestorium]
drincruz has joined #ruby
drincruz has quit [Ping timeout: 240 seconds]
cnsvc_ has joined #ruby
cnsvc_ has quit [Ping timeout: 240 seconds]
_whitelogger has joined #ruby
jetchisel has joined #ruby
reyfi9e has quit [Ping timeout: 256 seconds]
reyfi9e has joined #ruby
reyfi9e has quit [Ping timeout: 256 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
reyfi9e has joined #ruby
ruby[bot] has joined #ruby
donofrio has joined #ruby
_whitelogger has joined #ruby
gitter1234 has quit [Quit: Connection closed for inactivity]
jetchisel has quit [Ping timeout: 265 seconds]
jetchisel has joined #ruby
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 265 seconds]
ur5us has quit [Ping timeout: 260 seconds]
alexherbo2 has joined #ruby
NODE has quit []
Benett has quit [Remote host closed the connection]
Benett has joined #ruby
drincruz has joined #ruby
cnsvc_ has joined #ruby
drincruz has quit [Ping timeout: 240 seconds]
cnsvc_ has quit [Ping timeout: 240 seconds]
siery has quit [Quit: WeeChat 2.8]
drincruz has joined #ruby
NODE has joined #ruby
arooni_team_b has joined #ruby
arooni has quit [Ping timeout: 256 seconds]
dionysus69 has quit [Quit: dionysus69]
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
gavlee has joined #ruby
mheld has quit [Quit: Connection closed for inactivity]
bsdbandit-01 has joined #ruby
bsdband8 has quit [Ping timeout: 260 seconds]
_whitelogger has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xco has joined #ruby
alexherbo2 has quit [Ping timeout: 264 seconds]
ldepandis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ule> havenwood: I've been reading about the jemalloc you mentioned yesterday. Many people saying the same thing indeed
<ule> I'm excited to trying out
drincruz has quit [Ping timeout: 265 seconds]
<xco> i want to mimic the behavious of theh Dotenv gem and have say a .env file with some credentials that'll show as ENV variables. i've created a file called "credentials" with #!/usr/bin/env ruby in it followed by ENV['SECRET'] = 'xxx'
<xco> i expect that when i run "credentials" i shoould have access to theh ENV in ruby but shell says "credentials" is not a command
cnsvc_ has joined #ruby
<xco> before this i did `chmod +x credentials`
<xco> what am i doing wrong? or what's theh best way to have credentials saved in a ruby script thaht i can gitignore the credentials file?
<xco> sorry for typos, faulty keyboard
poro has joined #ruby
cnsvc_ has quit [Ping timeout: 240 seconds]
<adam12> xco: You'd need to call it with ./credentials
<adam12> xco: But that's likely not what you really want. You probably want to just `require_relative "credentials"`
<xco> `require_relative "credentials"` << this is what i've done in fact, but i thought i'll have an exetubale you can run so i can do more things in there than just keeping credentials
<adam12> Unless you're talking about the dotenv _binary_, which lets' you do `dotenv somecommand`?
<xco> adam12 like say setup some stuff
<xco> adam12 i don't want to do dotenv, try to keep dependencies to 0
ldepandis has joined #ruby
<adam12> xco: I'm not sure I follow. If you want to use it in another Ruby script, just require it. If it does more things, maybe you want something else that requires it and has the +x mode.
<xco> adam12 yup going the require_relative path :) thanks
drincruz has joined #ruby
drincruz has quit [Ping timeout: 265 seconds]
cnsvc_ has joined #ruby
<poro> Is there a way to constantly check for a keypress without blocking the flow of the script
<poro> like on a separate thread I guess it would have to be
cnsvc_ has quit [Ping timeout: 240 seconds]
kinduff has quit [Read error: Connection reset by peer]
ellcs1 has joined #ruby
kinduff has joined #ruby
drincruz has joined #ruby
ellcs1 has quit [Ping timeout: 260 seconds]
NODE has quit [Quit: changing servers]
NODE has joined #ruby
alexherbo2 has joined #ruby
drincruz has quit [Ping timeout: 246 seconds]
lesha has joined #ruby
bsdbandit-01 has quit [Quit: -a- Connection Timed Out]
bsdbandit-01 has joined #ruby
DTZUZU_ is now known as DTZUZU
DTZUZU has quit [Ping timeout: 265 seconds]
DTZUZU has joined #ruby
lucasb has joined #ruby
schne1der has quit [Ping timeout: 260 seconds]
drincruz has joined #ruby
cnsvc_ has joined #ruby
gdonald has quit [Remote host closed the connection]
lesha has quit [Ping timeout: 265 seconds]
CrazyEddy has quit [Remote host closed the connection]
lesha has joined #ruby
bsdbandit-01 has quit [Quit: -a- Connection Timed Out]
bsdbandit-01 has joined #ruby
DaRock has quit [Ping timeout: 272 seconds]
DTZUZU has quit [Quit: WeeChat 2.8]
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
xco has quit [Read error: Connection reset by peer]
ChmEarl has joined #ruby
bsdbandit-01 has quit [Quit: -a- Connection Timed Out]
bsdbandit-01 has joined #ruby
fuDwitc has joined #ruby
cnsvc_ has quit [Ping timeout: 240 seconds]
fuDwitc has quit [Remote host closed the connection]
fuDwitc has joined #ruby
fuDwitc has quit [Ping timeout: 260 seconds]
funnel has quit [Ping timeout: 260 seconds]
yokel has quit [Ping timeout: 260 seconds]
poro has quit [Ping timeout: 256 seconds]
yokel has joined #ruby
funnel has joined #ruby
bsdbandit-01 has quit [Quit: -a- Connection Timed Out]
bsdbandit-01 has joined #ruby
<havenwood> ule: :)
Esa__ has joined #ruby
<havenwood> poro, ah, they left - was just going to say that's what irb, pry, etc do - hence you'll see their processes have two threads when you start them.
BananaDisco has quit [Quit: Leaving]
ellcs1 has joined #ruby
<havenwood> &>> 0xACAB
<rubydoc> # => 44203 (https://carc.in/#/r/96kx)
kinduff has quit [Quit: gg]
imode has joined #ruby
Esa__ has quit []
Esa__ has joined #ruby
kinduff has joined #ruby
conta has joined #ruby
romanlevin has joined #ruby
conta has quit [Client Quit]
<jhass> &>> 0xACAB.to_s(15)
<rubydoc> # => "d16d" (https://carc.in/#/r/96ky)
<havenwood> jhass: I always want #hex to work in both directions: undefined method `hex' for Integer
<havenwood> I guess it makes more sense in the String-to-Integer directions but I must have tried it the other way around a dozen times without thinking.
<jhass> you just want people to do .hex.hex
<havenwood> haha
Esa__ has quit []
TCZ has joined #ruby
drincruz has quit [Ping timeout: 256 seconds]
TCZ has quit [Quit: Leaving]
kinduff has quit [Quit: gg]
kinduff has joined #ruby
bsdbandit-01 has quit [Quit: -a- Connection Timed Out]
bsdbandit-01 has joined #ruby
orbyt_ has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ellcs1 has quit [Ping timeout: 260 seconds]
ldepandis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
poro has joined #ruby
alexherbo2 has joined #ruby
ldepandis has joined #ruby
Mia has quit [Read error: Connection reset by peer]
ellcs1 has joined #ruby
poro_ has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
poro has quit [Ping timeout: 258 seconds]
gitter1234 has joined #ruby
bsdbandit-01 has quit [Quit: -a- Connection Timed Out]
bsdbandit-01 has joined #ruby
davispuh has joined #ruby
yxhuvud has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
yxhuvud has joined #ruby
prestorium has joined #ruby
ldepandis has quit [Ping timeout: 260 seconds]
GodFather has joined #ruby
braj has joined #ruby
bsdbandit-01 has quit [Quit: -a- Connection Timed Out]
Cosmin99 has joined #ruby
<Cosmin99> hello
<havenwood> Cosmin99: hi
<gitter1234> Hey guys :)
Cosmin99 has quit [Client Quit]
bsdbandit-01 has joined #ruby
hiroaki has quit [Ping timeout: 256 seconds]
_whitelogger has joined #ruby
poro_ is now known as poro
hiroaki has joined #ruby
hiroaki has quit [Ping timeout: 265 seconds]
braj has quit []
orbyt_ has joined #ruby
envex has joined #ruby
xco has joined #ruby
troulouliou_div2 has joined #ruby
<xco> if anyone has some time to review my code i'll be happy. i'd love comments on design and things that can be improved. i'm writing a scraper that goes through multiple levels of authentication to scrape data. reviews appreciated https://github.com/siaw23/alice
envex has quit []
envex has joined #ruby
<havenwood> xco: You can save a method call with: gets(chomp: true)
<havenwood> xco: I often explicitly use: $stdin.gets
<havenwood> xco: (#gets isn't always STDIN)
<havenwood> xco: You can consolidate these errors: https://github.com/siaw23/alice/blob/master/alice.rb#L36-L41
<havenwood> xco: rescue BadConnection, InvalidTOTP, BadAuthenticationCredentials => e
<havenwood> xco: (Since they're handled the same.)
<xco> +1
<havenwood> xco: It seemed odd to me to have #warn for success.
<havenwood> xco: I'd expect #puts.
<xco> #warn apparently is the same as $stderr
<havenwood> xco: Why print success to STDERR?
<havenwood> xco: Shouldn't it be STDOUT?
<xco> aaaaa on line 43
<xco> yeah right
<xco> rubocop replace my $stderr.puts
<xco> :/
<havenwood> xco: Makes sense to replace $stderr.puts with warn, but I don't get why it's err.
<havenwood> xco: Instead of out.
<xco> got it
<havenwood> xco: It seems like the name for the CSV file could be passed as an argument.
<havenwood> xco: A little OptionParser might be nice here.
<havenwood> xco: Or I guess since it's a single input, you could just: ARGV.shift
<havenwood> xco: ruby alice.rb name_of.csv
<havenwood> xco: If it's not provided you could ask for input.
<xco> could do it that way too, do you think it's any better than explicitely asking for input from the user?
<havenwood> xco: Typically option parsing is better than interactive input if the options can be known at the time the program is run.
<xco> +1
<havenwood> xco: Note how all the standard commands tend to option parse rather than query for input.
<havenwood> xco: OptionParser in the stdlib usually suffices.
<xco> will do some refactoring then
<havenwood> xco: web.rb makes me think of Forwardable
<havenwood> xco: There's a lot of delegation to @driver
<xco> havenwood talking about this https://github.com/ruby/forwardable ?
<havenwood> xco: Yes, it's in the stdlib: https://stdgems.org/forwardable/
<xco> oh i see it was added from Ruby 2.6 will that be correct?
<havenwood> xco: It's been in Ruby for ages and ages.
<havenwood> xco: It was recently "gemfied."
<havenwood> gemified*
<xco> aha!
<havenwood> xco: xco: def_delegators :@driver, :navigate_to, :find_element, find_element_by, find_element_by
<havenwood> xco: I prefer `ENV#fetch` to `ENV#[]` when the env var is required to be present.
<havenwood> (Blow up nicer.)
<havenwood> xco: Note, env vars are another way to pass info to a program like options or input query or config file.
<havenwood> or piping
<havenwood> xco: It's a good exercise to consider whether to support config file, env vars, options, pipes, and whether you should fall back and offer more than one of the above.
<havenwood> xco: This feels fun to refactor: https://github.com/siaw23/alice/blob/master/navigator.rb#L45-L61
<xco> havenwood i knew you'd pick that!!! a tried #fla_map, asked yesterday... paused midway
<xco> :D
<havenwood> xco: You can drop the `msg =` https://github.com/siaw23/alice/blob/master/exceptions.rb#L4
<xco> :)
<xco> how then do i pass the custom message? havenwood
<havenwood> xco: The `msg =` is just an unused assignment, no?
<havenwood> xco: Just pass the String.
<xco> havenwood to super you mean?
<xco> so super sends it up?
<havenwood> xco: Never mind that one!
<havenwood> xco: You want it optional?
<xco> :D
<havenwood> gotcha
<xco> ok
SeepingN has joined #ruby
<havenwood> xco: Consider just passing `options` to Navigator and have Navigator create the Web instance.
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
<havenwood> xco: I think it actually makes reading Navigator more simple and removes a line from alice to boot.
fuDwitc has joined #ruby
<xco> +1
<havenwood> xco: I dunno, but for these, is there any info from the error you should be passing on? https://github.com/siaw23/alice/blob/6fdea5d28cc12475eb6ae501e0bb3a999d348aa8/navigator.rb#L40-L41
<havenwood> xco: Once a project has this many files it kinda begs for a lib/ layout.
<xco> there is, i'm just not using it
<havenwood> aha
<havenwood> xco: That's all I've got. Looks good.
<xco> awesome!! thank you... :)
fuDwitc has quit [Ping timeout: 264 seconds]
sdrew has quit [Ping timeout: 272 seconds]
troulouliou_div2 has quit [Quit: Leaving]
fuDwitc has joined #ruby
fuDwitc has quit [Remote host closed the connection]
gavlee has quit [Excess Flood]
gavlee has joined #ruby
akem_ is now known as akem
bsdbandit-01 has quit [Ping timeout: 264 seconds]
bsdband86 has joined #ruby
bsdband86 has quit [Ping timeout: 264 seconds]
bsdbandit-01 has joined #ruby
prestorium has quit [Quit: prestorium]
xp has joined #ruby
xp has left #ruby [#ruby]
Jonopoly has joined #ruby
Jonopoly has quit [Client Quit]
plutes has joined #ruby
plutes has quit [Max SendQ exceeded]
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
cloaked1 has quit [Ping timeout: 246 seconds]
troulouliou_dev has joined #ruby
troulouliou_dev has quit [Ping timeout: 240 seconds]
troulouliou_dev has joined #ruby
cassolas has joined #ruby
troulouliou_dev has quit [Quit: Leaving]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
Azure has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cassolas has quit [Remote host closed the connection]
troulouliou_dev has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
troulouliou_dev has quit [Quit: Leaving]