adam12 changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.0.3, 2.7.5, 2.6.9: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
howdoi has quit [Quit: Connection closed for inactivity]
swaggboi has joined #ruby
<havenwood> cek: Normally you see that error when you think you have a Hash but it's really an Array.
ur5us_ has joined #ruby
cek has quit [Quit: Connection closed for inactivity]
roadie has joined #ruby
huma has joined #ruby
roadie has quit [Ping timeout: 240 seconds]
sylario has quit [Quit: Connection closed for inactivity]
huma has quit [Ping timeout: 268 seconds]
Rounin has quit [Ping timeout: 256 seconds]
<sagax> hi all
<sagax> what right way to check object about a class? i do this `object.class.name == SomeClass.name` but maybe we have better way?
<weaksauce> is there a specific reason for that sagax
<weaksauce> it's considered pretty not ideal
<sagax> ok
<sagax> my way not over bed?
<sagax> if i want just check, that object of SomeClass?
roadie has joined #ruby
<weaksauce> sagax what are you trying to actually accomplish?
<sagax> that object has inherit of required class
roadie has quit [Ping timeout: 240 seconds]
<weaksauce> it's considered very fragile and will break easily
<weaksauce> but you can use kind_of? https://rubyapi.org/3.0/o/object#method-i-kind_of-3F
<sagax> ok, thanks
<weaksauce> it is better to tend to do the duck typing thing where you shouldn't generally care if it is a class of xyz but that it responds to certain things
<weaksauce> but it is there if you want it
<sagax> i see, that kind_of? and is_a? it's aliases
<weaksauce> not aliases no
<weaksauce> oh nevermind i thought the truth table was different
<weaksauce> yeah i guess they are
<sagax> source
<sagax> i see*
roadie has joined #ruby
roadie has quit [Ping timeout: 268 seconds]
blakeorwhatever[ has joined #ruby
roadie has joined #ruby
roadie has quit [Ping timeout: 252 seconds]
bluedust has joined #ruby
ur5us_ has quit [Ping timeout: 240 seconds]
jhass has quit [Ping timeout: 240 seconds]
Al2O3 has quit [Quit: I'm quitting, thanks for all the sharks.]
Al2O3 has joined #ruby
bluedust_ has joined #ruby
hololeap has joined #ruby
bluedust has quit [Ping timeout: 240 seconds]
bluedust has joined #ruby
bluedust_ has quit [Ping timeout: 240 seconds]
jetchisel has joined #ruby
roadie has joined #ruby
darkstardevx has joined #ruby
darkstardevx has quit [Remote host closed the connection]
roadie has quit [Ping timeout: 268 seconds]
darkstardevx has joined #ruby
roadie has joined #ruby
aphysically has joined #ruby
<aphysically> is gem like python's pip where when everything says "just do pip install ___" they mean you actually DON'T want to do this unless you're in some kind of special environment?
jhass has joined #ruby
roadie has quit [Ping timeout: 268 seconds]
roadie has joined #ruby
roadie has quit [Ping timeout: 252 seconds]
_ht has joined #ruby
rhe has quit [Ping timeout: 240 seconds]
rhe has joined #ruby
roadie has joined #ruby
roadie has quit [Ping timeout: 268 seconds]
roadie has joined #ruby
roadie has quit [Ping timeout: 245 seconds]
teclator has joined #ruby
roadie has joined #ruby
roadie has quit [Quit: ERC (IRC client for Emacs 25.3.50.1)]
<havenwood> aphysically: nope
<aphysically> okay good :)
<havenwood> It's standard to install gems globally and that's actually the right way to do it.
<aphysically> it's funny that it's almost always a mistake in python yet they don't disable it by default
<havenwood> Apps use a Gemfile to specify deps and a Gemfile.lock contains the exact versions resolved so they can be used without any conflicts to the system gems.
Rounin has joined #ruby
bluedust has quit [Remote host closed the connection]
roadie has joined #ruby
bluedust has joined #ruby
<sagax> how to check - variable it's Class or Instance of Class ?
bluedust_ has joined #ruby
bluedust has quit [Ping timeout: 268 seconds]
___nick___ has joined #ruby
hololeap has quit [Excess Flood]
hololeap has joined #ruby
roadie has quit [Quit: ERC (IRC client for Emacs 25.3.50.1)]
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
<libsys> nakilon: already solved it, wasn't working because I was using ** with string based keys
<havenwood> sagax: foo.instance_of? Class
<sagax> not only Class, i mean any class
<sagax> i want something like as foo.is_instance_or_class?
<havenwood> sagax: Right, so like: Array.instance_of? Class #=> true
<havenwood> sagax: [].instance_of? Class #=> false
<sagax> hm, ok, thanks
<havenwood> sagax: Or: foo.is_a? Class
<sagax> when i wait answer, i write this `var.kind_of?(Class)`
<havenwood> Sure, kind_of? and is_a? are aliases.
<sagax> and i am glad, that change normal way to this
<havenwood> sagax: You can just check if it's a direct instance rather than kind of, since there's no subclass of Class that creates classes that's not itself an instance of Class..
<havenwood> Either work.
<havenwood> sagax: It's generally not something you should be having questions about for a variable. :P I guess *reasons*.
<havenwood> sagax: We might have other suggestions if you have more specifics, but that's the general solution I think.
<sagax> uff, when i will be have better question - i write it. but my english very bad, and i write like as i can. i learning english, but it's long way for me. thanks for help
jhass has quit [Ping timeout: 240 seconds]
yxhuvud has quit [Read error: Connection reset by peer]
yxhuvud has joined #ruby
jhass has joined #ruby
hololeap has quit [Remote host closed the connection]
hololeap has joined #ruby
geewiz has joined #ruby
fef has joined #ruby
jetchisel has quit [Ping timeout: 240 seconds]
huma has joined #ruby
Cork has joined #ruby
Cork has quit [Ping timeout: 240 seconds]
bluedust has joined #ruby
bluedust_ has quit [Ping timeout: 240 seconds]
samgranieri has joined #ruby
FetidToot has quit [Quit: The Lounge - https://thelounge.chat]
FetidToot has joined #ruby
jhass has quit [Ping timeout: 240 seconds]
huma has quit [Ping timeout: 268 seconds]
fercell has quit [Ping timeout: 256 seconds]
Cork has joined #ruby
Cork has quit [Ping timeout: 240 seconds]
gr33n7007h has quit [Quit: WeeChat 3.4]
jhass has joined #ruby
gr33n7007h has joined #ruby
John_Ivan has joined #ruby
lim has joined #ruby
ua_ has quit [Ping timeout: 252 seconds]
ua_ has joined #ruby
samgranieri has quit [Ping timeout: 240 seconds]
lim has quit [Ping timeout: 240 seconds]
<John_Ivan> anyone know a gem I can use to read into .rar files?
John_Ivan has quit [Read error: Connection reset by peer]
m_antis has quit [Quit: ZNC - https://znc.in]
John_Ivan has joined #ruby
m_antis has joined #ruby
<nakilon> John_Ivan which gem did you already try?
<nakilon> also try to learn people use .zip
<nakilon> *teach
goepsilongo has joined #ruby
bluedust has quit [Remote host closed the connection]
roadie has joined #ruby
danjo0 has quit [Quit: Ping timeout (120 seconds)]
danjo0 has joined #ruby
roadie has quit [Ping timeout: 245 seconds]
walidvb has joined #ruby
roadie has joined #ruby
ur5us_ has joined #ruby
roadie has quit [Ping timeout: 240 seconds]
samgranieri has joined #ruby
samgranieri has quit [Ping timeout: 240 seconds]
roadie has joined #ruby
fef has quit [Ping timeout: 276 seconds]
roadie has quit [Ping timeout: 240 seconds]
roadie has joined #ruby
_ht has quit [Remote host closed the connection]
walidvb has quit [Quit: Client closed]
___nick___ has quit [Ping timeout: 240 seconds]
roadie has quit [Ping timeout: 240 seconds]
roadie has joined #ruby
roadie` has joined #ruby
roadie` has quit [Client Quit]
roadie has quit [Ping timeout: 240 seconds]
Vaevictus has joined #ruby
<Vaevictus> if i've got two different array like objects... containing potentially a field that coordinates some records between the two ( a name )... what's a good way to get the venn diagram outputs of each one?
<Vaevictus> like ... in A not B, in B not A, in both?
<Vaevictus> i was doing a.select{ |au| b.select{ |bu| bu.thing == au.otherthing } } but it seems like i'm working too hard :D
<weaksauce> Vaevictus intersection
<weaksauce> and A - B, B - A
<Vaevictus> do i need to coersce them to be a similar structure?
<Vaevictus> one's from AD with all the AD bits and the other is a dump from a csv :|
<weaksauce> oh those are just methods on arrays
<Vaevictus> ahh
<Vaevictus> these may just be arrays of objects i suppose
<Vaevictus> gotta love writing administrative bits for enterprise services that don't exist
<weaksauce> you'd probably need to override equality
<weaksauce> not sure what they use? hash or ===
<Vaevictus> my current testing code (that verified things actually do work somewhat was) A.each { b.select{ equality here}.length } ( with some printing) which did actually get me what i hoped for
dstein64- has joined #ruby
<Vaevictus> maybe i should rename the attributes in one of them to match the other?
<Vaevictus> then i could hash compare the same field perhaps?
<Vaevictus> not sure if that'd help, i suppose
dstein64 has quit [Ping timeout: 252 seconds]
dstein64- is now known as dstein64
<Vaevictus> oh... map
<Vaevictus> i suppose i can merge them with map and do the logic in that and get my intersections and other bits that way.
<weaksauce> yeah lots of paths
<Vaevictus> probably wouldn't even be asking but my ruby books are at my house, and i'm rusty :D
<Vaevictus> i wonder if i shouldn't convert the arrays of hashes into hashes of hashes
<ccooke> Hmm. Probably the thing that would be easiest to read in six months when you have forgotten the why would be either a method turning the CSV into an AD-like hash, then something to diff the hashes?
nmollerup has quit [Remote host closed the connection]
nmollerup has joined #ruby
<ccooke> Or something that turns both into an idealised form, and again doing the comparison there
<ccooke> You're basically only after the diff, right?
<weaksauce> yeah that might make more sense
<weaksauce> later
<Vaevictus> yeah
<weaksauce> make a class of #thing
<weaksauce> build thing up
<Vaevictus> trying to determine which AD users need to be added to updox and which updox users who have been deleted from AD need to be deleted from updox
<weaksauce> what is the commonality?
<Vaevictus> just the name of the user.
<weaksauce> just a username?
<Vaevictus> and i suppose the email address.
<ccooke> Vaevictus: https://github.com/liufengyun/hashdiff (or something like it) would be a good basis, if you have something comparable on both sides
<weaksauce> just throw that in an array
<weaksauce> and use the name with - and intersect
<Vaevictus> the AD mail attribute should match the updox emailaddr attribute
<ccooke> yeah
<weaksauce> and is it a oneoff script or a thing you need in the future
<ccooke> the *simple* answer is a - b and b - a for those
<Vaevictus> i'm gonna run it hourly and email me if there's work to do
<ccooke> Vaevictus: https://xkcd.com/1205/ :-D
<Vaevictus> almost, ccooke
<weaksauce> hah yeah i'd just dump the usernames into an array and do a diff with -
<ccooke> weaksauce: yeah
<weaksauce> maybe normalize it to downcase first
<Vaevictus> the problem is that HIPAA is involved, so there's privacy issues... and also, different people doing deletions and additions on either system.
<ccooke> The least *complex* code is a good principle for systems code.
<Vaevictus> ahh...
<Vaevictus> reduce each side to ONLY the relevant data in the sort and use that. sounds so much better :D
<ccooke> Vaevictus: How do the privacy issues affect the script you're writing? I presume you have the privileges to extract and process the data?
<ccooke> Vaevictus: yes, exactly
<Vaevictus> ccooke: if someone fires a person and deletes them from AD but fails to delete them from updox, they could see sensitive information post-employment
<ccooke> Vaevictus: That's a reason why the script (and the work it helps with) is important. It's not actually a direct concern in writing the code
<weaksauce> it's a direct concern to get it completely right though
<ccooke> oh yes
<Vaevictus> which why i'm going to try and write all the logical bits of the diagram and compare the bits so that they add up to the whole, as part of this
yark has joined #ruby
<Vaevictus> updox users + missing users - yet-to-be-deleted users should equal current AD users
<Vaevictus> we'll see
yark has quit [Quit: Leaving]
<Vaevictus> oh... some of my updox "users" in my dump are not users, they have data in the email field but no @ ... what should i use to test that?
<Vaevictus> (users that i'm concerned with will have an @ in the email)
<Vaevictus> foo["key"]["value"].include?"@"
<Vaevictus> ?
<ccooke> Vaevictus: Possibly filter them out - foo.select { |u| u["key"]["value"].include? '@' }
<ccooke> Thinking in terms of maintenance - a chain of filters can be quite good in the sense it's easy to add another filter to the end later, if you need one
<ccooke> Vaevictus: You might want to consider writing some tests for this, though, given the importance of accuracy
<Vaevictus> yeah, i'm building a chain of selects and honestly, several lists... whenever i diverge from one list to two, i'm keeping both parts and ensuring i still have all the pieces accounted for.
TCZ has joined #ruby
<weaksauce> are you sure they are not valid users?
apple has joined #ruby
apple has left #ruby [#ruby]
teclator has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
TCZ has quit [Quit: Leaving]
geewiz has quit [Ping timeout: 240 seconds]
aphysically has left #ruby [#ruby]