<leitz>
bougyman, I have to write perl for my day job, so I write really simple stuff and comment it. And try to test it. And have my co-worker use it, to see what doesn't make sense.
<leitz>
Perl is a great language, but the learning curve is pretty steep since it uses a lot of symbology and context.
<leftylink>
`n.times { roles << x }` takes up too much room for my liking. I prefer `roles.concat([x] * n)`
<leftylink>
although written that way, it doesn't seem to take up that much more room...
<havenwood>
leitz: You could abstract this to a method that does the #each iteration then call it with a two parameters, the String and Integer of times.
<leitz>
leftylink, the second roles << will benefit from the concat, even more.
<leitz>
Should "crew" be an object, or something like a Struct?
<leitz>
havenwood, yeah, but that code came at 0500 this morning. Coffee was still kicking in...
<havenwood>
leitz: I'm just suggesting abstracting away from building an Array at all. :)
Swyper has quit [Remote host closed the connection]
<leitz>
havenwood, makes sense. In the current plan, all this does is print to the command line.
RougeR has quit [Ping timeout: 265 seconds]
<havenwood>
leitz: Yeah, I'm just noticing an abstractable pattern, and suggesting to do that rather than refine the current stab.
<havenwood>
leitz: Sometimes it doesn't pan out, but you have to try different things if you want to hone.
<havenwood>
leitz: I'm not complaining about this portion of the code. The latter half of the file reads pretty well.
<leitz>
havenwood, I just know that I tend to think like its a shell program, and I'm trying to learn to be more object-y.
<leitz>
"latter half" === "coffee working"
<havenwood>
leitz: Yeah, abstracting methods then metaprograming a bit can take it to the next level, *sometimes*.
<havenwood>
leitz: Looking for duplication and extracting methods where you see it is a good start.
jetchisel has joined #ruby
ldepandis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood>
leitz: In this case, it's not super straightforward how to extract. See what you think about a method that takes a String and amount of times to do it.
wildtrees has quit [Quit: Leaving]
<havenwood>
leitz: I think that will lead to further improvement options.
<havenwood>
leitz: First, what would you call what the #each here does in a succinct few words?
<havenwood>
leitz: It clearly takes two arguments, the String and Integer.
<havenwood>
leitz: So then think what to call them.
<havenwood>
leitz: Then rewrite to use this new method.
<havenwood>
leitz: And see what that looks like.
<havenwood>
leitz: Then think where the method belongs.
<havenwood>
leitz: Is there a class or module that it fits in with? Is it used elsewhere? Is it a one off method for this particular file?
<havenwood>
leitz: And then continue the refactor!
<havenwood>
Tests help refactoring speed a ton.
<leitz>
havenwood, we do have tests. Not great ones, but they are there.
<havenwood>
leitz: If the area you're refactoring has coverage for the behavior you'd like to keep working, you can refactor freely.
caterfxo has quit [Quit: leaving]
lucasb has quit [Quit: Connection closed for inactivity]
sergioro has joined #ruby
caterfxo has joined #ruby
* leitz
's brain has been processing. Code ain't looking good, though. Needs some processing and some sleep.
drincruz has joined #ruby
mozzarella has joined #ruby
Swyper has joined #ruby
alfiemax has joined #ruby
alfiemax has quit [Ping timeout: 260 seconds]
<leitz>
Okay, still needs a good bit of work, the repeated method calls seem, well, repetitive...
<leftylink>
either frontend or fire emblem are possible meanings I know for FE
renich has quit [Read error: Connection reset by peer]
cd has quit [Quit: cd]
mre- has joined #ruby
mre- has quit [Ping timeout: 260 seconds]
renich has joined #ruby
renich has quit [Remote host closed the connection]
s3nd1v0g1us has quit [Quit: WeeChat 2.6]
<raj>
thanks leftylink
gix has quit [Disconnected by services]
mre- has joined #ruby
braincrash has quit [Quit: bye bye]
Macrobiotic has quit [Quit: Connection closed for inactivity]
mre- has quit [Ping timeout: 258 seconds]
braincrash has joined #ruby
ur5us has quit [Ping timeout: 256 seconds]
donofrio has quit [Remote host closed the connection]
ReekenX has joined #ruby
mre- has joined #ruby
mre- has quit [Ping timeout: 260 seconds]
mre- has joined #ruby
mre- has quit [Ping timeout: 260 seconds]
segy has quit [Ping timeout: 272 seconds]
ReekenX has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Eiam has quit [Ping timeout: 240 seconds]
mheld has quit [Quit: Connection closed for inactivity]
mre- has joined #ruby
cliluw has quit [Read error: Connection reset by peer]
mre- has quit [Ping timeout: 255 seconds]
cliluw has joined #ruby
sauvin has joined #ruby
ttoocs has joined #ruby
mre- has joined #ruby
segy has joined #ruby
mre- has quit [Ping timeout: 260 seconds]
deam0 has joined #ruby
mre- has joined #ruby
mre- has quit [Ping timeout: 255 seconds]
schne1der has joined #ruby
alfiemax has quit [Remote host closed the connection]
mre- has joined #ruby
mre- has quit [Ping timeout: 255 seconds]
ur5us has joined #ruby
dinfuehr has quit [Ping timeout: 240 seconds]
dinfuehr has joined #ruby
chalkmonster has joined #ruby
alfiemax has joined #ruby
mre- has joined #ruby
alfiemax has quit [Ping timeout: 255 seconds]
ur5us has quit [Ping timeout: 256 seconds]
chalkmonster has quit [Quit: WeeChat 2.7.1]
mre- has quit [Ping timeout: 240 seconds]
ur5us has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
markopasha has joined #ruby
markopasha has quit [Max SendQ exceeded]
romanlevin has quit [Ping timeout: 268 seconds]
markopasha has joined #ruby
cthu| has quit [Ping timeout: 256 seconds]
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
mre- has joined #ruby
mre- has quit [Ping timeout: 268 seconds]
alexherbo2 has joined #ruby
deam0 has quit [Ping timeout: 258 seconds]
mre- has joined #ruby
mre- has quit [Ping timeout: 240 seconds]
alexherbo28 has joined #ruby
alexherbo2 has quit [Ping timeout: 255 seconds]
alexherbo28 is now known as alexherbo2
romanlevin has joined #ruby
mre- has joined #ruby
sdu has joined #ruby
mre- has quit [Ping timeout: 256 seconds]
cnsvc has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
_whitelogger has joined #ruby
tsujp has joined #ruby
troulouliou_dev has quit [Quit: Leaving]
krillbat has joined #ruby
mre- has joined #ruby
mre- has quit [Ping timeout: 255 seconds]
SanguineAnomaly has quit [Ping timeout: 260 seconds]
zenspider has quit [Ping timeout: 258 seconds]
mre- has joined #ruby
sauvin has quit [Ping timeout: 255 seconds]
mre- has quit [Ping timeout: 260 seconds]
cnsvc has joined #ruby
watzon has quit [Quit: Ping timeout (120 seconds)]
watzon has joined #ruby
zenspider has joined #ruby
axsuul has quit [Ping timeout: 256 seconds]
galaxie has quit [Ping timeout: 240 seconds]
ozzloy has quit [Ping timeout: 260 seconds]
cnsvc has quit [Ping timeout: 240 seconds]
lineus has quit [Ping timeout: 240 seconds]
ur5us has quit [Ping timeout: 240 seconds]
mre- has joined #ruby
chihhsin_ has quit [Ping timeout: 240 seconds]
chihhsin has joined #ruby
code_zombie has quit [Quit: Leaving]
TheBrayn has joined #ruby
mre- has quit [Ping timeout: 265 seconds]
dionysus69 has joined #ruby
lineus has joined #ruby
TomyLobo2 has joined #ruby
mre- has joined #ruby
galaxie has joined #ruby
jetchisel has quit [Ping timeout: 256 seconds]
cnsvc has joined #ruby
mre- has quit [Ping timeout: 255 seconds]
cnsvc has quit [Remote host closed the connection]
snickers has joined #ruby
snickers has quit [Client Quit]
conta has joined #ruby
mre- has joined #ruby
jetchisel has joined #ruby
conta1 has joined #ruby
cnsvc has joined #ruby
sergioro has quit [Read error: Connection reset by peer]
mre- has quit [Ping timeout: 265 seconds]
conta has quit [Ping timeout: 255 seconds]
conta1 is now known as conta
sergioro has joined #ruby
sauvin has joined #ruby
sauvin has quit [Max SendQ exceeded]
cnsvc has quit [Ping timeout: 240 seconds]
cnsvc has joined #ruby
roadie has quit [Quit: ERC (IRC client for Emacs 25.3.50.1)]
mre- has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
sergioro has quit [Ping timeout: 260 seconds]
mre- has quit [Ping timeout: 256 seconds]
<rapha>
morning all
<rapha>
is there a way that ruby can tell me the unicode *names* (e.g. "U+FEE2 ARABIC LETTER MEEM FINAL FORM") of each character in a string?
chalkmonster has joined #ruby
gordie has joined #ruby
ldepandis has joined #ruby
<gordie>
Hi ! in my code, importer = importer.class.getDetails returns an error : undefined method `getDetails' for NilClass:Class
<gordie>
how can I set the importer value to nil if importer does not exists, and to importer.class.getDetails if it exists ?
<jhass>
importer = importer.class.get_details if importer.class
<gordie>
nice, thanks
<gordie>
is this ok too ? importer ? importer.class.getDetails : Nil
<jhass>
rapha: ruby maintaining its own encoding tables, I don't think it has that info natively. I could imagine there's a gem importing it from the unicode data though
<bhaak>
the gem unicode-sequence_name does that
mre- has joined #ruby
gordie has quit [Remote host closed the connection]
mre- has quit [Ping timeout: 265 seconds]
krillbat has quit [Quit: Connection closed for inactivity]
cnsvc has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
<rapha>
hah! i knew Ruby had me covered, that's what I love her for :)
<rapha>
thank you guys! :)
donofrio has joined #ruby
<rapha>
hmm, okay, doesn't have you covered if you're not dealing with a "western" script, apparently. how braindead.
<rapha>
ur wairt
<rapha>
"a", "b", "c" are also not covered
<rapha>
wtf
<rapha>
only stuff like double exclamation marks and emojies
<rapha>
and tamil but not arabic or farsi?! what a weird library :-(
<bhaak>
oh, wait, you probably need unicode-name for the rest as well
cnsvc has joined #ruby
alfiemax has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
mre- has joined #ruby
<rapha>
bhaak: found the "uniscribe" command line tool that makes use of that library. that one works perfectly.
<rapha>
(and i want to test whole strings, anyways, not just single characters, so it's a good fit)
mre- has quit [Ping timeout: 265 seconds]
<bhaak>
ah, great
mre- has joined #ruby
arahael has joined #ruby
alfiemax has quit [Remote host closed the connection]
mre- has quit [Ping timeout: 255 seconds]
howdoi has quit [Quit: Connection closed for inactivity]
postmodern has quit [Quit: Leaving]
kinduff has quit [Read error: Connection reset by peer]
cnsvc has joined #ruby
kinduff has joined #ruby
mre- has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
mre- has quit [Ping timeout: 260 seconds]
alexherbo27 has joined #ruby
drincruz has joined #ruby
alexherbo2 has quit [Ping timeout: 268 seconds]
alexherbo27 is now known as alexherbo2
mre- has joined #ruby
mre- has quit [Ping timeout: 268 seconds]
burningserenity has joined #ruby
lxsameer has quit [Quit: WeeChat 2.6]
cnsvc has joined #ruby
lxsameer has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
cd has joined #ruby
lxsameer has quit [Quit: WeeChat 2.6]
lxsameer has joined #ruby
markoong has joined #ruby
AndroidKK is now known as AndroidKitKat
markong has joined #ruby
markoong has quit [Ping timeout: 268 seconds]
xco has joined #ruby
mre- has joined #ruby
vondruch_ has joined #ruby
Milos has quit [Ping timeout: 268 seconds]
mre- has quit [Ping timeout: 265 seconds]
vondruch has quit [Ping timeout: 258 seconds]
vondruch_ is now known as vondruch
infernix has quit [Ping timeout: 246 seconds]
infernix has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.7.1]
Milos has joined #ruby
stdedos has joined #ruby
zenox has joined #ruby
mre- has joined #ruby
<zenox>
hi, i'm trying to install huginn, and when i run a foreman start, despite starting, it immediately terminates with: /usr/local/bin/bundle:23:in `load': cannot load such file -- /usr/share/rubygems-integration/all/gems/bundler-1.16.1/exe/bundle (LoadError)
<zenox>
searching hasn't been much help
mre- has quit [Ping timeout: 256 seconds]
quintasan has joined #ruby
roadie has joined #ruby
alfiemax has joined #ruby
sdu has quit [Remote host closed the connection]
conta has quit [Quit: conta]
cnsvc has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
chalkmonster has joined #ruby
bvdw has joined #ruby
akem has joined #ruby
conta has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
jetchisel has quit [Ping timeout: 265 seconds]
jetchisel has joined #ruby
Swyper has quit [Remote host closed the connection]
<havenwood>
zenox: I'd suggest double checking that Bundler is installed in the current Ruby and try prefixing your command with `bundle exec`.
<adam12>
s/alphanumeric/alpha. I think alphanumeric is programmed into my fingers.
Swyper has quit [Remote host closed the connection]
jetchisel has quit [Ping timeout: 260 seconds]
<havenwood>
leitz: #match?, like adam12 showed, is better than #=~ when you're not using any of #=~'s magic variables, like $~.
<leitz>
adam12, I have a yaml document with some unicode in it. For some reason, the other program fails to load the document, so I want to remove the 4 unicode characters ( 128, 152, 153, 226), and see if that works.
<havenwood>
leitz: Share the YAML file that does't load?
<leitz>
havenwood, I can't. Work stuff. :(
<adam12>
leitz: Maybe you can just gsub those characters.
jetchisel has joined #ruby
<adam12>
leitz: Actually I notice you quoted the regexp value. Take the quotes off and you might be in business.
<havenwood>
TheBrayn: They match when negated, and when not. ¯\_(ツ)_/¯ That's very strange to me. The \p{} format works as I expect.
<zenox>
havenwood, thanks, yes, same error :(
<zenox>
havenwood, for the last 45 mins or so, a gem update command has been running. i'm not a ruby developer so no idea what's going on, and kinda hate it!
<havenwood>
zenox: What do you get for?: gem -v
<havenwood>
zenox: For example, I get: 3.1.2
<havenwood>
zenox: Is it version 2.7.7 or higher?
<zenox>
do i have to be in the same directory for that command?
<havenwood>
zenox: It would be ideal, just in case you have Ruby version switching set up.
<havenwood>
zenox: I suspect you're on an old version of Ruby and are running into a bug long since patched. If that's the case, you could install a newer version of Ruby or update RubyGems with: gem update --system
<zenox>
i get a whole load of deprecated messages and then 3.1.2
<havenwood>
Ah, then not on an old RubyGems.
<zenox>
i tried a gem update --system and that error'd out hours ago
<havenwood>
zenox: What are the deprecated messages about?
<havenwood>
zenox: What version of Ruby are you on? ruby -v
<zenox>
Gem::Specification#rubyforge_project= is deprecated with no replacement. It will be removed on or after 2019-12-01.
<zenox>
Gem::Specification#rubyforge_project= called from /var/lib/gems/2.5.0/specifications/rack-livereload-0.3.16.gemspec:16.
<havenwood>
zenox: It looks like you have RubyForge as a source in your Gemfile, but it's long gone. Switch the source to: https://rubygems.org
<zenox>
in most of the deprecation messages, it's the same first line, but different gems
<havenwood>
zenox: RubyForge used to be a site that hosted gems. Years back it shut down.
<zenox>
ah
<zenox>
i don't know, i did a apt install
<havenwood>
zenox: The "source" is where it's trying to fetch these gems from. The canonical one is: https://rubygems.org
<havenwood>
zenox: If you share your Gemfile, we may spot other issues. Is there a maintained version of this project? To be on RubyForge, you must be using very old code.
<zenox>
it's huginn
<havenwood>
zenox: Does it also have RubyForge source though?
<zenox>
i just downloaded the latest release i believe
<zenox>
gem update just seems to freeze on one gem when it's run
<zenox>
atm, 'installing darkfish documentation for twilio-ruby-5.31.6'
<zenox>
any ideas from the env?
<zenox>
well i think i officially give up on ruby!
mre- has quit [Ping timeout: 256 seconds]
cnsvc has joined #ruby
<havenwood>
zenox: Goodbye!
d3bug has joined #ruby
<havenwood>
zenox: With the next language you try, use a fresh box. You've badly broken this one.
<zenox>
i shouldn't need to use a 'fresh box' just because something is broken. this isn't windows!
<havenwood>
zenox: I don't think you're grasping that you've misconfigured your own system, and could do that with any language.
cnsvc has quit [Ping timeout: 240 seconds]
mre- has joined #ruby
<havenwood>
zenox: I can show you how to break Python or whatever else in a similar way. I'd help you debug with --verbose but I'm going to breakfast and you've "officially given up" so I won't try. :)
<zenox>
python is horrid too
<zenox>
but still, ruby is so fragile, i don't think misconfiguring it by using apt should be possible
<havenwood>
zenox: You haven't misconfigured apt. You've pointed RubyGems at an ancient source.
troulouliou_div2 has quit [Quit: Leaving]
<zenox>
i haven't
<zenox>
every source you've asked to see has been what it should be
burningserenity has quit [Ping timeout: 260 seconds]
<adam12>
This is generally a fault of distro packagers wanting to package things their own way and doing their own thing.
<adam12>
Uninstall Ruby through apt and follow instructions to build it separately and you'll probably have less issues.
<zenox>
see that's the issue. having to build a whole language because it's so fragile is a headache too much for me :(
<havenwood>
zenox: It took me about a minute to install this, but I have a working version of the latest stable Ruby installed.
<adam12>
zenox: Maybe you'd be better off paying for IFTTT
<adam12>
zenox: Or maybe see if they have a Docker image?
<zenox>
it's to eventually run on a pi 0, so docker isn't really possibly
<adam12>
zenox: Ruby isn't fragile here. I'm not sure how you can be new to Ruby and claim it's fragile. Seems kinda silly.
<zenox>
possible
<havenwood>
zenox: The only fragility is what you've introduced, I'm assuming at least. Was it not you who set up this /usr/lib/ruby/vendor_ruby/rubygems at some previous point?
<zenox>
i don't really have to compile php just to get it working
<zenox>
i don't really have to compile python to get it working
mre- has quit [Ping timeout: 265 seconds]
<zenox>
havenwood, nope
<havenwood>
zenox: I can't account for how you've broken Ruby. I've never had anything like this happen, and I've used Ruby on dozens of machines over many years.
<havenwood>
I'd personally nuke this from orbit, but I'm not comfortable with a system that has who knows what baggage from running commands you don't understand.
<adam12>
zenox: what distro is this?
entel has joined #ruby
<havenwood>
zenox: If you ever return to Ruby, we can help set up the latest stable version—either from source or via a package. It didn't take much to get this installed with a working Ruby.
conta has quit [Quit: conta]
cthu| has joined #ruby
burningserenity has joined #ruby
TomyWork has quit [Ping timeout: 256 seconds]
<apotheon>
zenox: The Debian packagers are, in some circles, (in)famous for mispackaging things. If they managed to create a broken package for Ruby, that's not Ruby's fault.
donofrio_ has joined #ruby
donofrio has quit [Ping timeout: 265 seconds]
<havenwood>
I'm unsure what even happened here. Where is this strange old gem coming from? Why so many paths in GEM_PATH?
<havenwood>
I'm also curious what distro.
aesthe has joined #ruby
<yxhuvud>
redhat also have more than a little experience of doing the wrong thing when it comes to packaging ruby things. historically no distros have been good at handling interaction with separate package handlers.
<zenox>
ubuntu, 16.10 i believe. maybe 18.10 off the top of my head
mre- has joined #ruby
<yxhuvud>
If you are running a x.10 version of ubuntu that isn't 19.10 then you are running a version that doesn't have any support from Ubuntu. Please for the love of $DEITY use either a long term support version, or the latest released version.
<yxhuvud>
You can see the exact version in /etc/lsb-release
<yxhuvud>
havenwood: Only the ones from even years.
<havenwood>
yxhuvud: Good point, not always.
paraxial has joined #ruby
CommunistWolf has joined #ruby
<havenwood>
Well, half the time. :)
reber has joined #ruby
gix has joined #ruby
jmcgnh has quit [Read error: Connection reset by peer]
mre- has joined #ruby
jmcgnh has joined #ruby
alexherbo24 has joined #ruby
alexherbo2 has quit [Ping timeout: 255 seconds]
alexherbo24 is now known as alexherbo2
hutch has quit [Quit: WeeChat 2.7.1]
markopasha has joined #ruby
fluxAeon has quit [Ping timeout: 240 seconds]
fluxAeon has joined #ruby
<leitz>
Hmm...still not getting an understanding of the unicode issue. If I pull the yaml file into a string, and then run the string through each_byte, the ones over 127 are 128, 152, 153, and 226. Yet I don't seem to get matches on them.
<havenwood>
leitz: Did you see my #delete suggestion?
<havenwood>
leitz: Can you share an example String via Gist?
_whitelogger has joined #ruby
<leitz>
havenwood, it's a large file. In this case, the likely culprit is the user info; name, gcos, shell, etc. I tried to find a string with â in it, but no luck.
<havenwood>
leitz: Can you show an offending snippet?
<leitz>
havenwood, that's just it. I can't find the offending snippet. It's 1.3M of UTF-8. :(
<adam12>
leitz: Do you have the original error that started you on this?
<leitz>
adam12, no. What's happening is the file chokes the PHP based intake process. No one else could figure it out, so I offered. My first guess is that there's a rogue UTF-8 character that's not being handled, since most similar files are ASCII based, based on the command "file".
<leitz>
But not all are ASCII, so I don't have a firm trigger point.
<bhaak>
is it possible that it's all valid utf-8 but some of the more complex characters make the your PHP parser trip?
bitwinery has joined #ruby
<bhaak>
like double width character, emojis, or a combination of unicode code points with combining characters that don't have a singe codepoint equivalent?
<leitz>
bhaak, that's my guess. The theory is that the mostly likely place for a utf-8 character that would cause an issue is in the user data. Trying to narrow it down a bit more, though.
bitwinery has quit [Remote host closed the connection]
bitwinery has joined #ruby
<havenwood>
leitz: So there's no Ruby error involved? You're just trying to scrub it in Ruby?
<havenwood>
leitz: Can you show us the PHP error?
<bhaak>
especially emojis have been known to show utf-8/unicode handling errors as they live in the astral plane, whereas most if not all characters western languages need are in the BMP.
<bhaak>
remember the mysql bug where the utf8 datatype only reserved 3 bytes instead of 4 for a codepoint
<leitz>
havenwood, yes to the first, and no to the second. They don't have enough logging enabled to get a specific error, it just "doesn't work".