howdoi has quit [Quit: Connection closed for inactivity]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
factormystic has quit [Read error: Connection reset by peer]
<oncall-pokemon>
havenwood: thank you so kindly
budonyc has quit [Quit: Leaving]
budonyc has joined #ruby
factormystic has joined #ruby
Technodrome has joined #ruby
cthu| has quit [Ping timeout: 240 seconds]
lostmywindows has joined #ruby
bambanx has joined #ruby
Fusl has quit [Ping timeout: 244 seconds]
pppktz has quit [Ping timeout: 272 seconds]
pppktz has joined #ruby
Fusl has joined #ruby
sphex has quit [Read error: Connection reset by peer]
sphex has joined #ruby
budonyc has quit [Quit: Leaving]
lostmywindows has quit [Ping timeout: 240 seconds]
kristian_on_linu has quit [Remote host closed the connection]
ChmEarl has quit [Quit: Leaving]
braincrash has quit [Quit: bye bye]
braincrash has joined #ruby
elphe has joined #ruby
lostmywindows has joined #ruby
fabio_ has joined #ruby
arzWZM has quit [Ping timeout: 265 seconds]
arzWZM has joined #ruby
MadLamb has quit [Ping timeout: 240 seconds]
nopolitica has joined #ruby
bruce_lee has quit [Ping timeout: 240 seconds]
bruce_lee has joined #ruby
bruce_lee has quit [Changing host]
bruce_lee has joined #ruby
nopolitica has quit [Quit: WeeChat 2.6]
lxsameer has quit [Ping timeout: 265 seconds]
Xiti` has joined #ruby
apotheon_ has joined #ruby
Xiti has quit [Read error: Connection reset by peer]
vqrs has quit [Ping timeout: 256 seconds]
apotheon has quit [Read error: Connection reset by peer]
jenrzzz has quit [Ping timeout: 240 seconds]
vqrs has joined #ruby
iNs_ has quit [Remote host closed the connection]
iNs has joined #ruby
_aeris_ has quit [Remote host closed the connection]
_aeris_ has joined #ruby
iNs has quit [Remote host closed the connection]
iNs has joined #ruby
jenrzzz has joined #ruby
lostmywindows has quit [Remote host closed the connection]
wymillerlinux has quit [Ping timeout: 240 seconds]
alfiemax has joined #ruby
mikkus has joined #ruby
mnathani has quit []
mnathani has joined #ruby
bambanx has quit [Quit: Leaving]
jenrzzz has quit [Ping timeout: 240 seconds]
venmx has joined #ruby
venmx has quit [Ping timeout: 260 seconds]
wymillerlinux has joined #ruby
ur5us has quit [Ping timeout: 256 seconds]
Uncle_Cid has joined #ruby
fabio_ is now known as MadLamb
<MadLamb>
I'm trying to add a condition for sunspot indexing, and I tried to declare a method to be checked. Ruby says "NameError (undefined local variable or method"... If i declare a property with the same name it works. Any clue?
UncleCid has quit [Ping timeout: 272 seconds]
Furai has quit [Quit: WeeChat 2.8]
jenrzzz has joined #ruby
bocaneri has joined #ruby
<havenwood>
MadLamb: What's a property?
<MadLamb>
havenwood, property in the OOP class concept
<havenwood>
MadLamb: Can you share the code or a snippet that reproduces?
<havenwood>
MadLamb: An accessor method?
roadie has joined #ruby
<MadLamb>
havenwood, property ... a class context variable
<MadLamb>
havenwood, private whatever = 1
<havenwood>
MadLamb: A class instance variable isn't exposed publicly without metaprogramming.
<havenwood>
MadLamb: An accessor method is what's used to expose a class instance variable.
<MadLamb>
havenwood, right, like a getter?
<havenwood>
MadLamb: Yes.
UncleCid has joined #ruby
mnathani has quit []
<havenwood>
MadLamb: attr_reader :foo
<havenwood>
MadLamb: Same as: def foo; @foo; end
<MadLamb>
havenwood, but anyway the issue was the opposite, searchable was not complaining with a "class instance variable", so probably was able to see it
<MadLamb>
havenwood, but when declaring a method with the same name it was saying method doesnt exist
<havenwood>
MadLamb: Can you share code that reproduces the issue, since I don't get what exactly you mean.
<MadLamb>
havenwood, I'm pass that problem however, it does not complain when using proc
<MadLamb>
havenwood, I was trying to put "has_spam" directly there
<havenwood>
MadLamb: And what's the full error?
<havenwood>
MadLamb: Assuming :has_spam?
<MadLamb>
havenwood, right now no error, but also no pp output
<MadLamb>
with has_spam directly there it was giving me the NameError I mentioned b4
<havenwood>
MadLamb: Post::has_spam is a class method but #method is being called on an instance of Post.
<MadLamb>
havenwood, you mean the self.?
apotheon_ is now known as apotheon
<MadLamb>
havenwood, I didnt have that b4
apotheon has quit [Changing host]
apotheon has joined #ruby
<havenwood>
MadLamb: The thing that matters for #method is what `self` is in the context.
Furai has joined #ruby
<MadLamb>
havenwood, hmm I see, when I remove the self. then I get back to that error
<havenwood>
MadLamb: I'd suggest using a REPL with binding.irb or binding.self so you can see what you're calling #method on.
<MadLamb>
havenwood, that was chinese to me
<MadLamb>
:D
<havenwood>
?irb MadLamb
* havenwood
pokes the bot
<havenwood>
MadLamb: irb is "interactive ruby", it is part of ruby. You can run ruby code and see results immediately. it's useful for testing code. Also see ?pry, a gem which is a popular alternative to irb.
<MadLamb>
ah right
<havenwood>
MadLamb: A `binding.irb` will jump into IRB.
<havenwood>
At that point.
schne1der has joined #ruby
<MadLamb>
should I write that in the code?
<havenwood>
MadLamb: Yeah, typically you do, just where you want to interactively explore.
<MadLamb>
that is an interesting way to debug
<havenwood>
the `proc(&method(:has_spam))` is odd, just because you typically can just: method(:has_spam)
<MadLamb>
havenwood, I just tested it and it works the same way as long as I have the self. there
<MadLamb>
havenwood, so the proc is not really needed
<MadLamb>
havenwood, I was getting the nameerror before because I did have the self.
<havenwood>
MadLamb: Yes, since #method is called on an instance, not on the class itself.
<havenwood>
MadLamb: As you see, with metaprogramming you can get at the method by checking the #method on the class itself, since it's a class method.
<havenwood>
MadLamb: If `self` is `Post` then #method will get at a class method.
<havenwood>
MadLamb: If `self` is `#<Post:...>` then #method will get at an instance method.
<havenwood>
MadLamb: Said another way, call method on a class you get a class method. Call method on an instance of a class, you get an instance method.
jenrzzz has quit [Ping timeout: 272 seconds]
roadie has quit [Ping timeout: 272 seconds]
<havenwood>
Pry, the better IRB, provides easy object inspection `ls`, `history`, viewing docs `?`, viewing source `$`, syntax highlighting and other features (see `help` for more). Put `binding.pry` in your source code for easy debugging. Install Pry (https://pryrepl.org/): gem install pry pry-doc
<havenwood>
Though IRB has improved and is quite nice these days.
<havenwood>
I guess I'm not a Pry power user if I really only use ls, reset and clear, heh.
<bougyman>
I use edit a lot, to get to source code I need.
<bougyman>
edit SomeClass.method, etc.
alexherbo2 has quit [Ping timeout: 240 seconds]
<havenwood>
bougyman: Yeah, that's a nice one
<havenwood>
I might should use it more
<havenwood>
The advent of `binding.irb` bridged a lot of gaps for me
<havenwood>
Or I guess just that one gap
<havenwood>
But now I use it a lot more
venmx has joined #ruby
alexherbo2 has joined #ruby
JRF has joined #ruby
venmx has quit [Ping timeout: 246 seconds]
CrazyEddy has joined #ruby
roadie has joined #ruby
alexherbo2 has quit [Ping timeout: 265 seconds]
mikkus has quit [Quit: Leaving]
wymillerlinux has quit [Ping timeout: 240 seconds]
<MadLamb>
havenwood, srry had to leave for few mins
<havenwood>
MadLamb: In `class Foo; self; def foo; self; end end` the first `self` is `Foo` and the second is `#<Foo>`, and instance of `Foo`.
<havenwood>
an instance*
<MadLamb>
havenwood, I didnt get the point you tried to make, both methods are declared without self. both method return different things and are called in different ways
<havenwood>
MadLamb: What `self` is matters since `method` is `self.method`.
schne1der has quit [Ping timeout: 258 seconds]
<havenwood>
MadLamb: Say more about what's not as you expect?
<MadLamb>
havenwood, in both cases you are creating an instance, and from the instance accessing the methods.
<havenwood>
MadLamb: What both cases?
<havenwood>
MadLamb: Referencing one of the gists?
<MadLamb>
havenwood, I'm very familiar with OOP in other languages, and usually self means class static call
<MadLamb>
havenwood, unless it means something else in ruby
<havenwood>
MadLamb: What `self` is depends on context in Ruby.
<havenwood>
MadLamb: It is not a single thing within a class definition.
<havenwood>
MadLamb: Why OO. Because humans. Were super wierd.
<havenwood>
We're `super` weird.
<MadLamb>
havenwood, when the same thing can mean different things its indeed challenging to understand why
alexherbo2 has joined #ruby
<havenwood>
MadLamb: I think of self as actually fundamental OO.
Uncle_Cid has joined #ruby
<havenwood>
MadLamb: It's a Smalltalk heritage, the Godfather of OO.
<havenwood>
MadLamb: I'll decline to defend OO generally unless it's its comic or artistic merits.
<havenwood>
It can help sometimes. But at what cost?
<phaul>
havenwood just use rubydoc as a fallback for facts, with &?
<havenwood>
At what cost?!?
<havenwood>
phaul: Ahhh, thanks!
robert__ has quit [Ping timeout: 272 seconds]
<havenwood>
&?botsnack
<rubydoc>
nomnomnomnom
<havenwood>
:D
<havenwood>
MadLamb: There are schools of OO, and they stare at each other with bewilderment. That's to be expected.
<havenwood>
MadLamb: Ruby is the Smalltalk variety. An old magic.
romanlevin333236 has joined #ruby
<MadLamb>
havenwood, yeah, there are new languages that are quite powerful in supporting those different paradigms and more deterministic about the concepts, but even then sometimes are misleading
jenrzzz has joined #ruby
romanlevin33323 has quit [Ping timeout: 246 seconds]
<havenwood>
MadLamb: Yeah, single paradigm languages get to be simpler.
dionysus69 has joined #ruby
<havenwood>
I do appreciate the functional side of Ruby. There's less to argue about if functional is the only option, but sometimes being able to poke your eye out also means great expressibility wielded adeptly.
<havenwood>
when wielded*
<havenwood>
Even a Z-Combinator looks more dapper with an adornment of OO.
<havenwood>
Just a fringe.
<havenwood>
MadLamb: <3 Elixir for Ruby-like freedoms with simpler functional style. It's really neat that Ruby inspired stretching the way Jose did with its design.
<MadLamb>
havenwood, for me its not so much about the language but really about the environment
<MadLamb>
havenwood, having worked with other languages I find it pretty painful to deal with Ruby
<havenwood>
And now that Ruby gets to borrow back from Elixir is double win.
<havenwood>
MadLamb: Which part of the Ruby environ bothers you?
<MadLamb>
havenwood, everything
<MadLamb>
havenwood, the way to debug, the way to run, the way to install dependencies
<havenwood>
MadLamb: Many langs have actually borrowed much from Ruby environment.
<havenwood>
MadLamb: What do you like?
<MadLamb>
havenwood, that is true
<MadLamb>
havenwood, my latest gig is Kotlin, but worked a lot with PHP, java, javascript, typescript, dart...
<MadLamb>
havenwood, problem with functional (but also true for oop in a smaller intensity) is that it can get messy very easily... there is often little enphasis on organizing the things
<havenwood>
MadLamb: Yarn was developed by one of the primary authors of Bundler. The premier MVC frameworks for PHP, Java, and {Java,Type}Script are modeled on Rubies. Node's reactor pattern is based on Ruby by a Ruby dv.
<MadLamb>
havenwood, the first framework I did with PHP was cakePHP, which was basically a Rails to php
prestorium has joined #ruby
<havenwood>
MadLamb: Yup, copying Rails.
<MadLamb>
havenwood, and it sucked hard :D (sorry to say)
<MadLamb>
hahaha
<havenwood>
MadLamb: A poor copy.
<MadLamb>
havenwood, perhaps.
<MadLamb>
havenwood, for RAD, quick prototyping there is no comparison
<MadLamb>
havenwood, but those projects quickly evolve into something long term
<MadLamb>
havenwood, and then everything is painful
kristian_on_linu has joined #ruby
<MadLamb>
havenwood, this library for example... sunspot. Solr directly in your Active Record models... What a great idea. Except when you dont want to index everything.
<MadLamb>
havenwood, a lot of unecessary coupling
<havenwood>
MadLamb: Those are libraries written in Ruby but the criticism has no bearing on Ruby that I can see.
<MadLamb>
havenwood, most of ruby developers are gem installers (I include myself there), and I think this is somehow pushed by the environment
<havenwood>
MadLamb: That's in no way Ruby specific.
<havenwood>
MadLamb: You've seen Node.
<MadLamb>
havenwood, I didnt find the same in other environments.
<havenwood>
MadLamb: Node is far worse on average as far as I've seen.
<MadLamb>
havenwood, yeah node suffers from the same or similar problem.
<havenwood>
MadLamb: Worse. Much worse.
<MadLamb>
havenwood, npm packages are awful
<havenwood>
MadLamb: Ruby has just been around longer than Dart and Kotlin, so it has had more time to accumulate both good and bad libraries.
<MadLamb>
havenwood, mostly writen by junior front end developers
<havenwood>
MadLamb: I don't find any of this particular to Ruby though. The Ruby tooling is above par.
romanlevin333236 has quit [Quit: Ping timeout (120 seconds)]
<MadLamb>
havenwood, that is true and I know some really awful design flaws of Dart
<MadLamb>
havenwood, even in language level components (not some random dude code)
<havenwood>
MadLamb: My Dart isn't the best, but I had fun being a guest on the Flutter Boring Show.
<MadLamb>
havenwood, :D
romanlevin333236 has joined #ruby
<havenwood>
More fun pairing with Avdi on some Dart. Screencasts coming soon. :)
<MadLamb>
check kotlin, you might enjoy its mixed fn + oop approach
<MadLamb>
I am curious to also try rust at some point
mossplix has joined #ruby
<havenwood>
MadLamb: My work uses Kotlin and it seems nice to me but I haven't had occasion to make anything in Kotlin.
<MadLamb>
havenwood, had two production projects with it already, love it
<MadLamb>
havenwood, (backend)
duderonomy has joined #ruby
Uncle_Cid has quit [Remote host closed the connection]
<havenwood>
MadLamb: JRuby to Kotlin bridge ftw? :P
Uncle_Cid has joined #ruby
<MadLamb>
havenwood, omg
<havenwood>
It's pretty nifty how easily JVM langs to play nice.
<MadLamb>
havenwood, idk, I dont see the point of being so much attached to the syntax. I used to be like that when I was doing PHP
<MadLamb>
havenwood, I think there are reasons why the syntax of those languages are different...
<MadLamb>
havenwood, kotlin is already doing the kotlin -> jvm stuff, so there is really no reason to have ruby syntax anywhere in the process
<MadLamb>
havenwood, my biggest pain point atm is related to performance, but I am not even sure if its worth to solve
<havenwood>
MadLamb: There's also no harm. The way things are heading the same VM is running the same code, so it's more important what we can be expressive in and what libraries are at hand.
<MadLamb>
havenwood, my app takes 1.5g ram
<havenwood>
Ruby actually leans towards prioritizing lower RAM usage, generally speaking.
<MadLamb>
havenwood, jvm is all about compatibility.. making sure you app runs anywhere. so i can see why doing something like jruby does take advantage of that... kotlin does the same, takes advantage of the jvm. You can however also do native with llvm
romanlevin333236 has quit [Quit: Ping timeout (120 seconds)]
akem has joined #ruby
romanlevin333236 has joined #ruby
<havenwood>
MadLamb: On that front, I actually consider AOT with GraalVM for Java/Kotlin more impressive.
<havenwood>
MadLamb: With these new technologies, the VMs let many languages enjoy the full benefits that few used to get.
<MadLamb>
havenwood, one thing is a simple example, another thing is a real world application using thousands of libraries... as I said before, its not about the language. its about the environment
<havenwood>
MadLamb: It's about neither the language nor the environment.
<havenwood>
MadLamb: ¯\_(ツ)_/¯
<MadLamb>
havenwood, indeed GraalVM is cool, I'm not a big fan of VM in general, but I can see how jruby makes sense.
rippa has joined #ruby
<havenwood>
MadLamb: If all these languages run on GraalVM or whatever else it just doesn't matter other than expressiveness and available libraries.
<MadLamb>
havenwood, I highly doubt you can reach less than 1G on a rails app using the available dependencies
<havenwood>
MadLamb: That said, I think tooling is of penultimate importance.
<MadLamb>
havenwood, unless you want to code every single line by yourself
<havenwood>
MadLamb: Huh?
Uncle_Cid has quit [Ping timeout: 258 seconds]
<MadLamb>
havenwood, my app is doing between 1.5G and 2.5G
UncleCid has joined #ruby
<MadLamb>
havenwood, I used to run my php stuff with 125mb limit
<havenwood>
MadLamb: Rails isn't a lightweight framework but sure you can get it under 1GB if that's what matters to you. If you want low memory usage choose a low memory usage framework not something that's expansive.
<MadLamb>
havenwood, if you code everything by hand, yes
<MadLamb>
havenwood, but in reality, you want to use the libraries that already solve the problem you want to solve available in the environment
<havenwood>
MadLamb: Yeah, I generally use my hands to code. I don't use Rails if memory is my main concern.
<MadLamb>
havenwood, and performance is probably the last concern the developers that wrote them had
<MadLamb>
havenwood, that takes a lot of time
<havenwood>
MadLamb: You have an odd Rails-oriented view of Ruby without knowing any Ruby it seems.
<havenwood>
MadLamb: Ruby is meant for expert C programmers but mistakenly we've all started using it. :P
<havenwood>
MadLamb: There are so many languages. Pick ones you like. I like Ruby and a bunch of other langs. I'd suggest trying more REPL driven development before giving up on it entirely.
romanlevin333236 has quit [Quit: Ping timeout (120 seconds)]
<MadLamb>
havenwood, no I said two or 3 times already that the language is not the issue
<havenwood>
MadLamb: I just don't see eye to eye with you on your criticisms. If you chose other languages as examples of good tooling, maybe. But your list I just don't see how Ruby, which they all borrow from, is the problem.
JRF has quit [Remote host closed the connection]
<havenwood>
PHP, maybe. Maybe that's a good idea.
JRF has joined #ruby
<havenwood>
Horrible, sure. But spin up, spin down and die is basically serverless. >.>
prestorium has quit [Quit: prestorium]
roadie has quit [Ping timeout: 260 seconds]
romanlevin333236 has quit [Client Quit]
<havenwood>
If you want to say Dart or Kotlin are better for mobile development... no argument from me.
romanlevin333236 has joined #ruby
<havenwood>
I'd personally rather code in Ruby rather than PHP, JavaScript or Java.
<havenwood>
If it's a browser, no argument with TypeScript.
<JRF>
havenwood: agreed. I have a love-hate relationship with JS... mostly hate
<havenwood>
JRF: It's gotten much better in recent years but I still can't bring myself to enjoy it like some here do.
<JRF>
havenwood: IMHO some of the newer features are either anti-patterns, or will be used badly
<JRF>
Like, the destructuring syntax... I'm not sure about
<JRF>
It's just a pain if, say, you end up *sometimes* needing to access other properties... or if accessing a property may throw an error
<MadLamb>
I have been doing TS but tbh dont like it so much. Its the best option atm, but suffers from the same problems nodejs does
<MadLamb>
sometimes even worse since its mostly front end
<MadLamb>
Im hoping wasm gets more mature soon
romanlevin333236 has quit [Quit: Ping timeout (120 seconds)]
<MadLamb>
working in whatever language you are already used to makes the life a lot easier
<JRF>
hmm... PHP-to-wasm compiler...
iNs has quit [Remote host closed the connection]
lxsameer has joined #ruby
<JRF>
I should make a ruby-to-PHP transpiler. how hard could it be, lol
iNs has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
<MadLamb>
JRF, there are two projects in php I was researching the other day... but the main actually got the interpreter to wasm with the idea that you run raw php code on the browser. It does work, but it is considerably slow.
<MadLamb>
JRF, I think the only sane idea is that you get your application to wasm instead.
<JRF>
MadLamb: eh. idk anything about wasm
<JRF>
I do know wordpress would probably be less miserable if i could at least *pretend* i'm actually coding in ruby ;)
<MadLamb>
JRF, :D php, especially after 7.0 is not bad
<MadLamb>
JRF, the problem is again not in the language, but in the framework
<MadLamb>
JRF, wordpress sucks
<MadLamb>
JRF, I dont think it would be any better if written in ruby
<leftylink>
however, it does not appear you care whether you have procs or lambdas. in that case, is there any reason not to use `-> { _1 > _2 }` instead?
<leftylink>
oh hold on I need to see whether that's ok
<adam12>
I do find some things in Python strange after writing Ruby for so long. Joining array's is maybe #1 that catches me all the time. "-".join(ary)
<oats>
heh, that did always feel backwards to me
mossplix has quit [Read error: Connection reset by peer]
<adam12>
Ruby's enumerable chain is probably one of it's best features. people.map(&:capitalize).join(", ")
mossplix has joined #ruby
<oats>
mmm, FPish
mossplix has quit [Remote host closed the connection]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
teclator has joined #ruby
roadie has quit [Ping timeout: 272 seconds]
mossplix has joined #ruby
Fusl has quit [Max SendQ exceeded]
Fusl has joined #ruby
roadie has joined #ruby
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
dviola has joined #ruby
fercell has quit [Quit: WeeChat 2.8]
teclator has quit [Remote host closed the connection]
baojg has quit [Remote host closed the connection]
baojg has joined #ruby
teclator has joined #ruby
bsdbandit-01 has quit [Ping timeout: 272 seconds]
bsdband89 has joined #ruby
roadie has quit [Remote host closed the connection]
Eiam has joined #ruby
roadie has joined #ruby
rafadc has quit [Read error: Connection reset by peer]
rafadc has joined #ruby
[ is now known as uplime
postmodern has joined #ruby
TCZ has joined #ruby
schne1der has joined #ruby
akem_ has joined #ruby
akem has quit [Ping timeout: 258 seconds]
fercell has joined #ruby
cthu| has joined #ruby
cthu| has quit [Read error: Connection reset by peer]
imode has joined #ruby
cthu| has joined #ruby
roadie has quit [Ping timeout: 272 seconds]
deathwishdave has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alexherbo2 has quit [Ping timeout: 240 seconds]
roadie has joined #ruby
fercell has quit [Ping timeout: 240 seconds]
zapata has quit [Quit: WeeChat 2.8]
fercell has joined #ruby
orbyt_ has joined #ruby
SeepingN has joined #ruby
cthu| has quit [Read error: Connection reset by peer]
cthu| has joined #ruby
alfiemax has joined #ruby
Omnilord has quit [Quit: Leaving]
fercell has quit [Ping timeout: 272 seconds]
deathwishdave has joined #ruby
ph88 has quit [Ping timeout: 272 seconds]
alexherbo2 has joined #ruby
alexherbo2 has quit [Ping timeout: 260 seconds]
renich has joined #ruby
alexherbo2 has joined #ruby
venmx has quit [Ping timeout: 256 seconds]
venmx has joined #ruby
s2013 has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
RiPuk_ has joined #ruby
RiPuk has quit [Ping timeout: 256 seconds]
roadie has quit [Ping timeout: 260 seconds]
TCZ has quit [Quit: Leaving]
orbyt_ has joined #ruby
Bish has quit [Disconnected by services]
xall__ has joined #ruby
roadie has joined #ruby
alfiemax_ has joined #ruby
<xall__>
I want to get a random sequence of len (say 6) from the set [*'a'..'z', *'A'..'Z', *'0'..'9']. Is there a way to do it that isn't slow (don't create entire array of combinations)? I have `[*'a'..'z', *'A'..'Z', *'0'..'9'].combination(6).to_a.sample(1)` but of course this is slow
alfiemax has quit [Ping timeout: 256 seconds]
<havenwood>
xall__: Do you want there to be repetitions in your sample of six?
<xall__>
@havenwood yeah, i think that solution is 62!/(62-6)!. Repeating should be 62^6. I wasn't sure if there a concise way to get 62^6
<havenwood>
xall__: There should probably be a publicly exposed version of SecureRandom::choose that returns an Array or an alternative to Array#sample. How about the example I just pasted?
<havenwood>
Just ignore the 30 lines of gibberish... 🙈
renich has quit [Quit: renich]
renich has joined #ruby
alfiemax has joined #ruby
alfiemax_ has joined #ruby
<xall__>
@havenwood I hope so! haha
<xall__>
this is great. thanks
roadie has quit [Ping timeout: 256 seconds]
<havenwood>
xall__: No prob. You're welcome.
alfiema__ has joined #ruby
alfiemax has quit [Ping timeout: 256 seconds]
<xall__>
my first thought was wondering if there was a way to use lazy to do it but that might be incoherent
alfiemax has joined #ruby
alfiemax_ has quit [Ping timeout: 246 seconds]
vondruch_ has joined #ruby
alfiema__ has quit [Ping timeout: 265 seconds]
vondruch has quit [Ping timeout: 240 seconds]
vondruch_ is now known as vondruch
thecoffemaker has quit [Ping timeout: 256 seconds]
thecoffemaker has joined #ruby
jottr has joined #ruby
alfiemax has quit [Remote host closed the connection]
cnsvc has joined #ruby
alexherbo20 has joined #ruby
alexherbo2 has quit [Ping timeout: 246 seconds]
alexherbo20 is now known as alexherbo2
memcorrupt has joined #ruby
memcorrupt has joined #ruby
memcorrupt has quit [Changing host]
memcorrupt has quit [Client Quit]
_whitelogger has joined #ruby
xall__ has quit [Quit: Connection closed]
Omnilord has joined #ruby
renich has quit [Ping timeout: 256 seconds]
Fusl has quit [Max SendQ exceeded]
Fusl has joined #ruby
mikhailnovikov has quit [Ping timeout: 240 seconds]
mnathani has joined #ruby
roadie has joined #ruby
<mnathani>
I am having difficulty displaying a nested hash. My hash looks like : {"totalresults"=>2, "products"=> {"product"=>[{"id"=>40043, "name"=>"Me"},{"id"=>9, "name"=>"You"}]}}
<mnathani>
I would like my expected output to be the values of id and name separated by commas one per line
<kaleido>
how are trying to get that output?
<mnathani>
I had this earlier response.transform_values { |v| v.tr("\n,", ';') if v }.values_at
<mnathani>
but getting errors now
<mnathani>
that one was for a simple hash, not nested
<leftylink>
it's not easy for me to see how the tr("\n," ...) at all, since no values in this hash appear to hvae a \n or , in them
alexherbo23 has joined #ruby
<leftylink>
s/at all/is related to this problem/
<leftylink>
dman
<leftylink>
s/at all/is related to this problem at all/
alexherbo2 has quit [Ping timeout: 256 seconds]
alexherbo23 is now known as alexherbo2
<leftylink>
the recommendations that come to my mind. Hash#dig is easy way to descend multiple levels into a hash. Then, one might use either string interpolation or String#%, based on preference, to format a single {"id"=>...,"name"...} hash.
CrazyEddy has quit [Ping timeout: 265 seconds]
roadie has quit [Ping timeout: 260 seconds]
<apteryx>
hello, is there a bundle query I can do to know which package propagateded a dependency pulled by 'bundle install' ?
renich has joined #ruby
CrazyEddy has joined #ruby
<adam12>
apteryx: I don't think there's anything built into bundler, but you can get this out of Gemfile.lock.
<apteryx>
adam12: thanks, that seems to have what I was looking for
wildtrees has joined #ruby
<apteryx>
well, not totally, but it's a start
wildtrees has quit [Remote host closed the connection]
TCZ has joined #ruby
wildtrees has joined #ruby
graphicsv has joined #ruby
wildtrees has quit [Remote host closed the connection]
wildtrees has joined #ruby
TCZ has quit [Quit: Leaving]
mikhailnovikov has joined #ruby
maidhc has joined #ruby
dionysus69 has quit [Ping timeout: 256 seconds]
renich has quit [Ping timeout: 264 seconds]
cnsvc has quit [Ping timeout: 240 seconds]
cnsvc has joined #ruby
bsdbandit-01 has joined #ruby
cliluw has quit [Ping timeout: 240 seconds]
bsdband89 has quit [Ping timeout: 246 seconds]
cliluw has joined #ruby
BenDover has quit [Quit: BenDover]
mossplix has quit [Remote host closed the connection]
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
SeepingN has joined #ruby
maidhc has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
SeepingN has joined #ruby
ur5us has joined #ruby
orbyt_ has joined #ruby
<al2o3-cr>
yes! chicken chow mein
maidhc has joined #ruby
jetchisel has joined #ruby
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
SeepingN has joined #ruby
mossplix has joined #ruby
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
howdoi has joined #ruby
wildtrees has quit [Remote host closed the connection]
wildtrees has joined #ruby
cliluw has quit [Ping timeout: 256 seconds]
wildtrees has quit [Remote host closed the connection]
wildtrees has joined #ruby
cliluw has joined #ruby
maidhc has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
arzWZM has quit [Ping timeout: 246 seconds]
arzWZM has joined #ruby
plutes has joined #ruby
Omnilord has quit [Quit: Leaving]
renich has joined #ruby
maidhc has joined #ruby
gix has joined #ruby
TCZ has joined #ruby
maidhc has quit [Client Quit]
maidhc has joined #ruby
TCZ has quit [Quit: Leaving]
skx86 has quit [Quit: Connection closed for inactivity]
cliluw has quit [Ping timeout: 240 seconds]
cliluw has joined #ruby
maidhc has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]