kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kyrylo has joined #ruby
arup_r has quit []
kyrylo has quit [Client Quit]
al2o3-cr has joined #ruby
RedSnarf has joined #ruby
al2o3-cr has quit [Read error: Connection reset by peer]
<marz_d`ghostman>
'@gmail.com<U+200B>'.encode(Encoding.find('ASCII'), {:invalid => :replace, :replace => ''}) doesn't seem to remove the <U+200B> unicode, how do I remove it?
dar123 has joined #ruby
salerace has joined #ruby
_whitelogger has joined #ruby
DarthGandalf has quit [Ping timeout: 252 seconds]
mikecmpb_ has joined #ruby
marmotini has quit [Ping timeout: 272 seconds]
mikecmpbll has quit [Ping timeout: 258 seconds]
lunarkitty7 has quit [Ping timeout: 252 seconds]
lunarkitty7 has joined #ruby
miskatonic has quit [Quit: ERC (IRC client for Emacs 24.5.1)]
haxx0r has quit [Ping timeout: 248 seconds]
regedit has quit [Quit: Connection closed for inactivity]
mikecmpb_ has quit [Read error: Connection reset by peer]
andikr has joined #ruby
mikecmpbll has joined #ruby
apparition has joined #ruby
haxx0r has joined #ruby
AJA4350 has quit [Remote host closed the connection]
<ryouba>
btw i've started calling arrays of regular expression "regosaurs". as in: `regosaurs = [/one/, /two/, /.../]`. makes coding much more fun.
schne1der has joined #ruby
<WolfgangGrobar>
What is more widely used in the ruby community: Test::Unit or Minitest (please ignore rspec)? Also what is usually used for mocking? Is the mocking stuff in minitest enough?
AJA4350 has joined #ruby
ua has joined #ruby
<havenwood>
WolfgangGrobar: Minitest
kapilp has quit [Quit: Connection closed for inactivity]
spacesuitdiver has joined #ruby
DarthGandalf has joined #ruby
<Jonopoly>
Anyone used Ruby & Selenium for testing?
<havenwood>
Jonopoly: Yes, that's popular.
<xco>
Jonopoly: Yes :P
<WolfgangGrobar>
Thank you, havenwood.
<xco>
WolfgangGrobar: as far as i know Test::Unit is quite out-dated. These days it’ only Minitest you’d see around
<WolfgangGrobar>
xco: good, then I'll use that
<Jonopoly>
havenwood: xco: OH is it? I'm learning it now and its pretty fun
conta has joined #ruby
AJA4350 has quit [Remote host closed the connection]
spacesuitdiver has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cliluw has quit [Ping timeout: 248 seconds]
cliluw has joined #ruby
slackmare has quit [Ping timeout: 258 seconds]
spacesuitdiver has joined #ruby
teclator has quit [Ping timeout: 272 seconds]
spacesuitdiver has quit [Client Quit]
cthulchu_ has joined #ruby
zapata has joined #ruby
doodlebug has joined #ruby
doodlebug has quit [Max SendQ exceeded]
Nicmavr has quit [Ping timeout: 245 seconds]
TheBrayn has quit [Ping timeout: 252 seconds]
doodlebug has joined #ruby
Nicmavr has joined #ruby
doodleb56 has quit [Ping timeout: 258 seconds]
TheBrayn has joined #ruby
teclator has joined #ruby
RedSnarf has quit [Quit: Yaaic - Yet another Android IRC client - http://www.yaaic.org]
WolfgangGrobar has quit [Ping timeout: 256 seconds]
galeido has quit [Ping timeout: 246 seconds]
teclator has quit [Ping timeout: 246 seconds]
nowhereman has joined #ruby
nowhere_man has quit [Read error: Connection reset by peer]
WolfgangGrobar has joined #ruby
code_zombie has joined #ruby
blackmesa1 has joined #ruby
<WolfgangGrobar>
What is the idiomatic ruby way to do the equivalent of dependency injection? I ask because of this Yegge quote: "Dependency Injection is [...] a popular new Java design pattern that programmers using Ruby [...] have probably never heard of. And if they've heard of it, they've probably (correctly) concluded that they don't need it."
i1nfusion has quit [Remote host closed the connection]
rippa has joined #ruby
<phaul>
not sure about being idiomatic there. it's debatable.
<WolfgangGrobar>
This looks like standard constructor dependency injection with default params. What am I missing?
<adam12>
WolfgangGrobar: There's a bunch of ways to "dependency inject" in Ruby. The constructor with default params is just one method. I don't think any specific way is "idiomatic".
<WolfgangGrobar>
I understood the quote to mean that it would be done somehow different in ruby.
<adam12>
WolfgangGrobar: Oh. I think people expect more than what is required.
nowhereman has quit [Ping timeout: 245 seconds]
<adam12>
WolfgangGrobar: The simplest solution is indeed accessors and perhaps params to the constructor. At the opposite end of the scale is something like dry-auto_inject which is paired with some sort of IoC container.
doodlebug has quit [Read error: Connection reset by peer]
doodlebug has joined #ruby
<WolfgangGrobar>
I see, so it seems not really different.
doodleb87 has joined #ruby
nowhereman has joined #ruby
doodlebug has quit [Ping timeout: 272 seconds]
Jonopoly has quit [Quit: WeeChat 2.4]
blackmesa1 has quit [Ping timeout: 252 seconds]
esp32_prog has quit [Ping timeout: 272 seconds]
graphene has joined #ruby
graphene has quit [Remote host closed the connection]
nowhere_man has joined #ruby
nowhereman has quit [Ping timeout: 248 seconds]
vondruch has quit [Quit: vondruch]
APK is now known as AKPWD
conta has quit [Quit: conta]
ellcs has quit [Ping timeout: 252 seconds]
tdy has joined #ruby
edwardly has quit [Ping timeout: 244 seconds]
AJA4350 has joined #ruby
nowhere_man has quit [Ping timeout: 257 seconds]
conta has joined #ruby
doodleb87 has quit [Read error: Connection reset by peer]
Swyper has quit [Read error: Connection reset by peer]
ravenous_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
leitz has joined #ruby
jenrzzz has joined #ruby
AJA4350 has joined #ruby
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
octos has quit [Remote host closed the connection]
octos has joined #ruby
fphilipe has joined #ruby
jeremycw has quit [Ping timeout: 246 seconds]
jeremycw has joined #ruby
jenrzzz has quit [Ping timeout: 248 seconds]
dellavg_ has quit [Ping timeout: 272 seconds]
nevada1 has joined #ruby
<nevada1>
Is there a more elegant way to split a number into groups of 3 digits? number.to_s.reverse.scan(/\d{1,3}/).map(&:reverse).map(&:to_i)
<nevada1>
(and then getting the integer out of each group)
octos has quit [Ping timeout: 258 seconds]
Tempesta has quit [Quit: See ya!]
<mikecmpbll>
nevada1 : what's all the reversing about?
jenrzzz has joined #ruby
<mikecmpbll>
ah, so the incomplete group is always at the front?
<nevada1>
e.g. 1_326_767 => '7676231' => ['767', '623', '1'] => (now comes reversing each one, because 623 should be 326) => ['767', '326', '1'] => [767, 326, 1]
luminousnine has quit [Quit: Goodbye ~ Powered by LunarBNC]
<havenwood>
mikecmpbll: I was checking on the nightly build, hmmmm. I'm curious now.
<leitz>
nevada1, I come from shell, with some python, perl, C, Go, PHP. When I tell people what's "the best language" I suggest they try several in whatever domain they want to program in. Ruby is the most joy for me.
laaron has joined #ruby
<rocx>
nevada1: ruby has the advantage of being quicker and in a sense more pure when it comes to objects.
<leitz>
havenwood, how relevant is that spec? It's 10 years old.
<leitz>
I remember getting yelled at for using old Ruby. :)
<havenwood>
leitz: It's mostly relevant, but yeah, it doesn't cover anything recent.
<leitz>
Then I got yelled at for using new Ruby...
<nevada1>
I mainly faced issues with Rubocop telling me how to do things. < 10 lines per method, too many assignments, blah-blah. I needed to adapt my way of thinking.
<leitz>
nevada1, I quit using Rubocop. It's not a bad idea, but it's not the law.
<havenwood>
mikecmpbll: I can reproduce your results... Intriguing!
<havenwood>
mikecmpbll: It looks like it changes between 2.5 and 2.6.
<mikecmpbll>
i'm sure that speed is critical to your application!
<havenwood>
mikecmpbll: step(3) is faster on 2.4 & 2.5 but b = 0, c = 0 is faster on 2.6 and dev. I guess 2.6 optimizations are paying off.
doodleb45 has joined #ruby
<mikecmpbll>
question is, is b = 0, c = 0 on 2.6 faster than step(3) on 2.5 ?
<havenwood>
yup!
<mikecmpbll>
a-ha ;)
<havenwood>
err
<havenwood>
actually...
<havenwood>
hah, no!
<mikecmpbll>
😂
<havenwood>
mikecmpbll: ah, I betcha that it's Enumerator Instruction Sequence...
<havenwood>
yeah, that's gotta be it
doodlebug has quit [Ping timeout: 272 seconds]
<havenwood>
that adds a penalty that's noticeable in this tight loop
<nevada1>
In case you are curious why I needed such a silly thing in the first place. https://dpaste.de/z25P
<nevada1>
I was working on that.
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 258 seconds]
AJA4351 is now known as AJA4350
<nevada1>
It's now a (somewhat) decent number wordifier.
mochiyoda_ has joined #ruby
polishdub has quit [Quit: leaving]
xco has joined #ruby
mochiyoda has quit [Ping timeout: 248 seconds]
<nevada1>
I'm open to any suggestions if you see something that hurts your eyes.
<leitz>
nevada1, smarter people than me have said you must code to get better at coding. Finding a language you enjoy coding in helps motivate that process.
skryking has joined #ruby
<nevada1>
leitz: That sounds like a reasonable statement.
Xiti has quit [Quit: Xiti]
<leitz>
I have been in Perl for a few months. Powerful language, makes me feel as worn out as Frodo and Sam crossing the wastes before going to Mordor. A day back with Ruby and I'm enjoying code again.
mikecmpbll has quit [Quit: inabit. zz.]
fphilipe_ has joined #ruby
<nevada1>
I was more or less forced to learn Ruby because of my job.
<nevada1>
Still in a love and hate relationship with it.
<rocx>
nevada1: if you think ruby's pretty good, wait until you try crystal.
<rocx>
then you'll know the true meaning of a love-hate relationship. ;p
<nevada1>
rocx: I did try it, actually.
<rocx>
heh.
<nevada1>
I have only good things to say about it so far.
<rocx>
makes me miss method overloading to be honest.
<leitz>
Yeah, a job requirement can cause issues.
<nevada1>
Specifying types is something I would love to be able to do in Ruby sometimes.
<nevada1>
As in having that in the core language, not using some gem.
Xiti has joined #ruby
<rocx>
hence the overloading. change how a method works based on type.
jenrzzz has quit [Ping timeout: 268 seconds]
esp32_prog has joined #ruby
<leitz>
There's some good to be said for Go. Not a bad language, typed, and the object system is much simpler.
Nicmavr has quit [Ping timeout: 245 seconds]
Kestrel-029 has joined #ruby
doodleb45 has quit [Read error: Connection reset by peer]
<nevada1>
I like it because it's pretty C-like. Anything that resembles C is enjoyable for me.
weird_error has joined #ruby
<leitz>
Yup. I'm glad your brain rejoices in C. Mine just barely gets it.
<nevada1>
It's the first language I learned.
doodlebug has joined #ruby
<leitz>
Wow. You're smarter than me then. I started on Pascal.
esp32_prog has quit [Ping timeout: 272 seconds]
<nevada1>
If smarter means needing to learn it for Computer Science, then yeah, haha.
<nevada1>
But along the way came Ruby and it shattered everything.
gr33n7007h is now known as al2o3-cr
<leitz>
I was an electronics guy but needed some computer credits. Pascal, C, and Netware 3.
<nevada1>
Another thing I kinda dislike about Ruby is that function calls can lack ( ).
<leitz>
I've been an apprentice in a few languages but found Ruby and really started to understand more about OOP, testing, etc.
weird_error has quit [Quit: weird_error]
<leitz>
"Whereever you go, there you are." I'd suggest leaving other language idioms with the other languages, it just makes your joy less.
<nevada1>
Before diving into it, I thought it's only used with Rails and that's about it.
al2o3-cr has quit [Quit: If the universe is a machine where the future is uniquely determined by its present state, it would not be possible to calculate what the future will be.]
stryek has quit [Quit: Connection closed for inactivity]
<nevada1>
But maybe there's some truth in that. Before Rails, I don't think too many people knew about Ruby outside of Japan.
<nevada1>
Or so I've heard.
<leitz>
Sadly, that's most of the Ruby market. There are other web options and most anything you can do with Python or Perl you can do with Ruby. You can drop directly into C as needed.
<rocx>
nevada1: first heard of it in RPG Maker XP. but that might still be the "japan" part.
weird_error has joined #ruby
<leitz>
I first heard of it in Chef and Puppet, which is why I started learning it.
weird_error has quit [Client Quit]
<nevada1>
So yeah, 1996 to 2005, Ruby not as popular, then Rails comes along and books about it. You could create a blog in 15 minutes and that appealed to people. As other programming languages evolved and their respective frameworks, and new ones popped up, I think Ruby started declining a bit since... 2015?
<rocx>
shame. it's a beautiful...ish language.
jenrzzz has joined #ruby
AJA4350 has quit [Ping timeout: 258 seconds]
<nevada1>
The community seems to be trying to branch out a bit from developing mainly with Rails. Dry-rb appears to be an alternative, or so it was stated in a 2017 Ruby conference.
<nevada1>
But what do I know, I'm probably trying to preach to the pope here.
darix has quit [Quit: may the packets be with you...]
<rocx>
nanoc's also a good site generator for the fact you can make it nearly do bloody well anything.
<leitz>
Sinatra, Roda, for web. Puppet and Chef for Config mgmt. Really, lots of other stuff possible. The colleges seem to be moving to Python though.
<nevada1>
Yeah, Python is in CS 101.
<rocx>
> implying colleges will be moving away from java
<leitz>
rocx, yes.
<nevada1>
There's C, Python and Java in CS, mainly.
<rocx>
...C? in college? you sure undergrads will be able to understand pointers?
<leitz>
The new Java license will spook a lot of folks and Python is winning the Data Science slot over R.
<rocx>
because half of my java classes can't even grasp objects. some can't even grasp methods.
<nevada1>
rocx: You bet, haha, it's what I had to do.
<nevada1>
There's always OpenJDK, thankfully.
fphilipe_ has quit [Ping timeout: 252 seconds]
<nevada1>
I also learned that you can run Ruby on the JVM, with JRuby.
<nevada1>
Though I don't know how popular that is.
<rocx>
probably not so popular since ruby's popularity is declining thanks to everyone moving everything to js.
<rocx>
(and it's a righteous pain in the butt if your hardware isn't top-of-the-line)
<nevada1>
It's amazing to see how a language that was never intended to deliver anything more than a little DOM manipulation became what it is today.
<nevada1>
(js)
<rocx>
and a poor one at that.
<nevada1>
It appeals to people because it's easy to write.
<brool>
i hate the js craze
<nevada1>
Preach.
<brool>
we need more c++ and websites should be written in WASM
* brool
runs
<rocx>
nevada1: and then how it handles types becomes problematic.
<rocx>
typeof([] + []) for example
<rocx>
and "0" == 0 and 0 == [] but "0" != []
<nevada1>
You have TypeScript that... tries to solve that.
<brool>
one thing that's evidently very bad about the js craze is how people are writing native desktop applications with it using electron
sagax has quit [Remote host closed the connection]
<brool>
discord makes my fans spin just by being idle
<rocx>
brool: and that's just chrome.
darix has joined #ruby
<brool>
firefox with 20 tabs and multiple windows doesn't do that
<brool>
coffeescript best javascript
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<brool>
it's like ruby and python had a javascript baby
<nevada1>
Can you imagine the layers of abstraction? You have the hardware, the OS, the graphical environment, a (headless) browser that runs on top of it and needs to make OS calls and an interpreter inside it.
fphilipe_ has joined #ruby
jenrzzz has quit [Ping timeout: 259 seconds]
<nevada1>
It's huge.
* brool
runs back to gcc
* brool
clings to machine code
jenrzzz has joined #ruby
<brool>
AND you have people trying to use and learn OOP design patterns in a language that doesn't even really do OOP
<nevada1>
OOP is weird because every language implements it differently.
<nevada1>
Python doesn't even have proper encapsulation.
<brool>
javascript does OLOO :^)
<nevada1>
You prefix variables with __ to make them appear private.
<nevada1>
That's a joke.
<brool>
heh yeah python is pretty ugly
<brool>
it's like the nerdy kid at school who went on to be a scientist but nobody will ever date him
<nevada1>
More like the guy who tries to do everything but does a lot of things badly.
AJA4350 has joined #ruby
<brool>
" ".join(reverse(string.split())) [iirc]
<nevada1>
Maybe except Machine Learning.
<brool>
eugh
Kestrel-029 has quit [Ping timeout: 245 seconds]
Nicmavr has joined #ruby
<brool>
why no string.split("").reverse.join(" ")
<brool>
cus that's pretty
<brool>
you see what's going on in the order it makes sense to think about it
fphilipe_ has quit [Ping timeout: 252 seconds]
Freshnuts has joined #ruby
<nevada1>
How do you add functionality do Ruby? Do you write C programs using the ruby header files?