baweaver changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.5.1, 2.4.4, 2.3.7, 2.6.0-preview2: 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!
phaul has quit [Ping timeout: 252 seconds]
kn-928 has joined #ruby
schneider has joined #ruby
kn-928 has quit [Client Quit]
freemo has joined #ruby
<freemo> Hello everyone! Is this a good spot to ask dumb noob questions?
justinmcp_ has quit [Quit: No Ping reply in 180 seconds.]
justinmcp has joined #ruby
schneider has quit [Ping timeout: 246 seconds]
Xiti has quit [Quit: Xiti]
freemo has quit [Remote host closed the connection]
freemo_ has joined #ruby
justinmcp has quit [Client Quit]
<freemo_> sorry was disconnected
<freemo_> not sure why... anyway my question..
c0ncealed3 has quit [Ping timeout: 245 seconds]
Xiti has joined #ruby
Cyrus is now known as Guest26490
axsuul has quit [Ping timeout: 252 seconds]
justinmcp has joined #ruby
schneider has joined #ruby
Creatornator has joined #ruby
<freemo_> Im a noob to ruby (sorta) but expiernced coder so i know the concepts. I have some code im working on with a complex class / module hierarchy. All the classes need to be serialized to json and back to be saved and restored regularly. I recently included a module into my class from a third-party library that allows me to do events (subscribing to events on a class). Problem is the internal data it uses to do this cant be serialized (and i
<freemo_> dont want it to be). So when my objects try to serialize the built-in marshalling method throws an error
cpallares has quit [Ping timeout: 252 seconds]
uplime has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
Guest26490 has quit [Ping timeout: 252 seconds]
<freemo_> I am trying to find some simple way to make it so the default marshalling method is still invoked but it ignored the included module but still marshals everything else automatically as usual
octomancer has quit [Ping timeout: 264 seconds]
<freemo_> In other languages like java this means adding a @transient annotation or similar. But I cant find anything like that in ruby. Any ideas?
WebDawg has quit [Ping timeout: 252 seconds]
c0ncealed3 has joined #ruby
Dark_Arc has quit [Ping timeout: 252 seconds]
jmcgnh has quit [Quit: ZNC 1.7.1 - https://znc.in]
jmcgnh has joined #ruby
Dark_Arc has joined #ruby
cpallares has joined #ruby
axsuul has joined #ruby
Cyrus has joined #ruby
WebDawg has joined #ruby
schneider has quit [Ping timeout: 245 seconds]
<havenwood> freemo_: What does @transient put in place of the serialized class? A null? (I don't quite understand.)
<havenwood> freemo_: So you're serializing an instance of your class, and the included module is borking it?
<havenwood> freemo_: Can you define #dump and ::load yourself, explicitly?
<freemo_> havenwood: correct, the included module is breaking the serialization
schneider has joined #ruby
<havenwood> freemo_: I'd suggest defining ::load and #dump on the class, so you can omit whatever the included module is trying to serialize.
<freemo_> havenwood: in java the @transient is just a marker. It marks the variable as transient, when the serialization process sees this it ignores the field and doesnt serialize it, when it deserializes it it will be null by default, yea.
<freemo_> havenwood: yea i can implement the mashaling methods (i think its called marshal_dump and marshal_load).. problem is that will break the marshalling of superclasses too, which all marshall their own variables in special ways potentially.
<havenwood> freemo_: _dump and _load are aliases, iir
<havenwood> freemo_: aha
<freemo_> havenwood: by the way it is all opensource so i can share the repo or the code if it helps
<havenwood> freemo_: Yeah, that'd help!
<freemo_> ok let me get the link
code_zombie has joined #ruby
schneider has quit [Ping timeout: 252 seconds]
<freemo_> havenwood: btw ignore the readme, its actually a MMORPG game all text based
<havenwood> freemo_: Which is the class that's failing to serialize?
<freemo_> well ive got those edits local but i can push it to a branch so you can see it
<freemo_> just giv eme a second ill do that
mikecmpbll has quit [Quit: inabit. zz.]
<freemo_> havenwood: ok so pushed a branch called broken, its the player class, one sec ill link
schneider has joined #ruby
<freemo_> havenwood: notice that include Whisper thing .. thats what breaks serialization
<freemo_> but ill be adding that to virtually every class once i get it to work. so i need a flexible solution
Fr4n has joined #ruby
schneider has quit [Ping timeout: 252 seconds]
bkxd has quit [Ping timeout: 244 seconds]
sarmiena_ has quit [Ping timeout: 244 seconds]
orbyt_ has joined #ruby
schneider has joined #ruby
sarmiena_ has joined #ruby
kurko_ has joined #ruby
<freemo_> havenwood: still with me?
sarmiena_ has quit [Client Quit]
<havenwood> freemo_: Finishing up work - will take a look momentarily
<freemo_> havenwood: no rush, thanks
schneider has quit [Ping timeout: 252 seconds]
darkhanb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
schneider has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
schneider has quit [Ping timeout: 260 seconds]
AJA4350 has quit [Remote host closed the connection]
kurko_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood> freemo_: It looks like there's not much difference on the broken branch: https://github.com/Syncleus/Aethyr/compare/broken
<freemo_> havenwood: very little difference, it is simply the act of adding that include that breaks things
schneider has joined #ruby
<havenwood> freemo_: There isn't a new include?
<freemo_> havenwood: also the breaking change is on master, it wasnt in the new branch, my istake
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<freemo_> the new branch includes it too though from master
<freemo_> havenwood: that line is what breaks it (and the similar line in manager)
<havenwood> freemo_: I'm curious to find a generic solution now, sec.
schneider has quit [Ping timeout: 246 seconds]
<freemo_> sure
vqrs has quit [Ping timeout: 252 seconds]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
edwardthefma has left #ruby ["Quit message"]
Demos[m] has quit [Ping timeout: 250 seconds]
schneider has joined #ruby
<havenwood> freemo_: Not sure if this solves your problem, but it's interesting: https://gist.github.com/havenwood/54f7eccbb145238994deeb86b2d6fd84
Demos[m] has joined #ruby
<havenwood> I'll try to make a better version.
vqrs has joined #ruby
<freemo_> havenwood: based on the code I take it you actually ran the program and reproduced the error yourself?
<freemo_> If so im impressed you figured out how to run and reproduce the code so quickly without my help
schneider has quit [Ping timeout: 252 seconds]
<freemo_> *reproduce the bug
<freemo_> havenwood: to use that code i suppose I just include safeSerialize anywhere i include wisper?
<havenwood> freemo_: yup
bmurt has joined #ruby
<freemo_> havenwood: since you actually ran the program and all, if you feel like it id be curious to hear your thoughts on the game in general. Though may be off topic here
cagomez has joined #ruby
schneider has joined #ruby
<freemo_> havenwood: what im going to do (tell me if this isnt going to work) is just include wisper directly into SafeSerialize (and name it something else). Then ill include that module instead of wisper itself. That way i just need to do one include
<havenwood> freemo_: Yes, that sounds to me like it'd work. I have to relocate, but I'll think more on this.
<freemo_> havenwood: alright, ill be around until my connection drops for some reason. I appreciate the help
schneider has quit [Ping timeout: 268 seconds]
dviola has joined #ruby
schneider has joined #ruby
dviola has quit [Client Quit]
bkxd has joined #ruby
gheegh has joined #ruby
schneider has quit [Ping timeout: 276 seconds]
asphyxia has joined #ruby
schneider has joined #ruby
elcontrastador has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
vqrs has quit [Ping timeout: 252 seconds]
vqrs has joined #ruby
schneider has quit [Ping timeout: 250 seconds]
hays_ is now known as hays
Creatornator has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
schneider has joined #ruby
<havenwood> freemo_: This is my current thinking (caveat, it's been a long day and this looks insane to me): https://gist.github.com/havenwood/ae6fe35b5d006358c81ad6c3b99c6b21
noobineer has joined #ruby
schneider has quit [Ping timeout: 252 seconds]
schneider has joined #ruby
<freemo_> havenwood: looking now
Demos[m] has quit [Ping timeout: 250 seconds]
esrse has joined #ruby
Demos[m] has joined #ruby
<freemo_> havenwood: that ooks similar to the direction i was going to go originally. Issue would be that it completely overrides marshalling methods on the base classes
gheegh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<freemo_> havenwood: so if a base class does something special when marshalling this would break it
schneider has quit [Ping timeout: 250 seconds]
Tempesta has quit [Ping timeout: 252 seconds]
<freemo_> havenwood: side note: I had no idea a class could be extended from Module or what that class << self bit does... but like i said im a noob
schneider has joined #ruby
asphyxia has quit [Ping timeout: 276 seconds]
ansraliant has joined #ruby
schneider has quit [Ping timeout: 268 seconds]
schneider has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
schneider has quit [Ping timeout: 252 seconds]
schneider has joined #ruby
schneider has quit [Ping timeout: 252 seconds]
schneider has joined #ruby
Blaguvest has quit []
dbz has joined #ruby
schneider has quit [Ping timeout: 252 seconds]
darkhanb has joined #ruby
schneider has joined #ruby
_whitelogger has joined #ruby
dbz has quit [Remote host closed the connection]
schneider has quit [Ping timeout: 250 seconds]
dbz has joined #ruby
dbz has quit [Remote host closed the connection]
schneider has joined #ruby
dbz has joined #ruby
dbz has quit [Remote host closed the connection]
schneider has quit [Ping timeout: 252 seconds]
za1b1tsu has joined #ruby
schneider has joined #ruby
asphyxia has joined #ruby
dbz has joined #ruby
dmitch has quit [Quit: Textual IRC Client: www.textualapp.com]
dbz has quit [Remote host closed the connection]
schneider has quit [Ping timeout: 272 seconds]
braincrash has quit [Quit: bye bye]
orbyt_ has joined #ruby
schneider has joined #ruby
braincrash has joined #ruby
Creatornator has joined #ruby
<freemo_> havenwood: still there? I'm a little confused how to use your mod...
<freemo_> nvm
<havenwood> freemo_: Hey, yup - just got back. Let me look at this again and see if I'm thinking clearer now.
schneider has quit [Ping timeout: 250 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nadir has joined #ruby
<havenwood> freemo_: That more recent, convoluted gist was my attempt to let you list the ivars to not dump from the outside.
<havenwood> include DoNotDump[:@bad, :@another, :@etc]
ivanskie has joined #ruby
dbz has joined #ruby
asphyxia has quit [Quit: Lost terminal]
<freemo_> havenwood: yea i noticed that a second later.. it is still giving me problems but im looking into why now...
<havenwood> freemo_: I'm tempted to want to try super for the case you mention above, where the class already has custom marshalling - but it seems like a pain to get working for various reasons.
dbz has quit [Remote host closed the connection]
<havenwood> Also this class variable is just... uhhg. But I'm not sure how to get around that either: https://gist.github.com/havenwood/ae6fe35b5d006358c81ad6c3b99c6b21#file-do_not_dump-rb-L11-L12
schneider has joined #ruby
<havenwood> A couple odd patterns there, but it works. ¯\_(ツ)_/¯
<havenwood> Or kinda works. :P
<freemo_> havenwood: did you try running the gist before hand? because it doesnt work for me and looks like it shouldnt have worked for you either
<havenwood> freemo_: Yes, it works for me.
<havenwood> Marshal.load Marshal.dump Example.new #=> #<Example:0x0000000110b368a0>
<havenwood> freemo_: Just reran it on 2.5.1.
<freemo_> havenwood: weird, for me it just recursively calls itself infinitely till it crashes
<havenwood> freemo_: Errr, just running this example does?: https://gist.github.com/havenwood/ae6fe35b5d006358c81ad6c3b99c6b21
fluxAeon has quit [Ping timeout: 244 seconds]
<havenwood> freemo_: Just tried in IRB and Pry and no issue here.
<havenwood> freemo_: What Ruby version are you using?
<freemo_> havenwood: no running it in the code itself, here i can show you the code once i integrated it
<freemo_> havenwood: this is my code after i added you stuff in: https://github.com/Syncleus/Aethyr/compare/broken?expand=1
<havenwood> freemo_: I just tried it with my example code.
<freemo_> havenwood: line 25 in publisher at the link i just pasted you is the line that recursively gets called over and over till it crashes...
<freemo_> so must be something i edited.
schneider has quit [Ping timeout: 250 seconds]
<havenwood> freemo_: Ah, your problem is the edit, yeah: include Marshaller[]
bkxd has quit [Ping timeout: 268 seconds]
<havenwood> freemo_: What's the name of the instance variable you don't want to marshal? Do you know?
<havenwood> include Marshaller[:@instance_variable_name_here]
<freemo_> havenwood: no i dont know yet, i was going to run it and try to determine that from the error it would produce
<freemo_> havenwood: i figured id run it and when it complained about not being able to marshal the variable then id add it, as i dont recall what the variable was
pabs has quit [Ping timeout: 264 seconds]
<freemo_> havenwood: i just tried creating a dummy variable called "foobar" and ignored that (just so i passed some instance variable in).. same problem
<havenwood> freemo_: Yeah, it should actually work empty - so that's odd.
schneider has joined #ruby
<freemo_> havenwood: i think marshal.dump is just an alias for marshal_dump
<freemo_> which is why
<havenwood> freemo_: What's the error you're getting?
<freemo_> havenwood: its a really long stack trace witht he same two lines repeated over and over again (line 25 in publisher).. indicating its just infinitely recursive. I can paste it though on a paste bin, one sec
<havenwood> freemo_: Marshal.dump is this method: https://docs.ruby-lang.org/en/2.5.0/Marshal.html#method-c-dump
<havenwood> freemo_: The #marshal_dump method is defining a different method for a particular object.
<freemo_> havenwood: https://pastebin.com/VVi6WnAV
pabs has joined #ruby
<ruby[bot]> freemo_: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
kujira has joined #ruby
<freemo_> havenwood: i suspect that there is some magic somewhere in my project (i didnt write it all myself, i took from an old opensource project) that made it an alias somewhere maybe
<havenwood> freemo_: Are you inheriting from Array or something?
<havenwood> Hrmm, how odd...
<freemo_> havenwood: no but the array class was modified by some code somewhere
<freemo_> let me find that
schneider has quit [Ping timeout: 252 seconds]
<freemo_> havenwood: not sure if this is relevant, but you mentioned Array, the Array class is modified here: https://github.com/Syncleus/Aethyr/blob/master/lib/aethyr/core/objects/inventory.rb#L3
<freemo_> havenwood: this may also be relevant. It seems to be defining those marshal methods: https://github.com/Syncleus/Aethyr/blob/master/lib/aethyr/core/util/rproc.rb
<freemo_> oh wait
<freemo_> that rproc one i dont think is relevant
schneider has joined #ruby
<havenwood> freemo_: How odd, so you're right about what it appears to be. `Marshal.dump` would call `data`'s #marshal_dump, but `data` is an instance of Array, and you've presumably not mixed this into Array.
<freemo_> yea i dont fully understand it mysef. But that could just be my noobiness
cagomez has quit [Remote host closed the connection]
asphyxia has joined #ruby
schneider has quit [Ping timeout: 244 seconds]
<havenwood> freemo_: I can easily reproduce a stack level too deep with: class Array; include DoNotDump[] end
<havenwood> freemo_: But I have no idea why it's happening in your code.
<havenwood> freemo_: Sec
<freemo_> maybe it is trying to marshal an array somehow i dunno let me poke around more
dbz has joined #ruby
<havenwood> freemo_: Just curious, but is it the same error if you change line 23 to be `end.to_h` here: https://github.com/Syncleus/Aethyr/blob/broken/lib/aethyr/core/util/publisher.rb#L23
<freemo_> let me try
<havenwood> That's just confirm it occurs with Marshaling a Hash as well as an Array at least.
<freemo_> havenwood: yea same error
schneider has joined #ruby
<freemo_> havenwood: its hard for me to help you debug this as i really dont understand a lot of the idioms you used in the code
<havenwood> freemo_: mmm, and would you mind also confirming that reversing the orders of the includes here has no issue?: https://github.com/Syncleus/Aethyr/blob/broken/lib/aethyr/core/util/publisher.rb#L32-L33
<havenwood> freemo_: I'd be happy to walk you through that code. It's abnormal code.
<freemo_> havenwood: id appreciate that just so i can understand ruby a little better
dbz has quit [Ping timeout: 252 seconds]
<havenwood> freemo_: You might prefer to use the earlier gist, since it's a lot less convoluted code to hardcode the ivars: https://gist.github.com/havenwood/54f7eccbb145238994deeb86b2d6fd84
<freemo_> havenwood: reversing the order on the includes didnt change anything
dviola has joined #ruby
<havenwood> freemo_: I assumed it wouldn't, but a clue that isn't involved.
jokester has joined #ruby
<freemo_> havenwood: i like the non-hardcoded one better, assuming it worked. As id like to reuse this solution on many classes
<freemo_> havenwood: with thaT SAID IF THE EARLIER CODE IS THE ONLY ONE THAT WORKS (DIDNT TRY IT IT MIGHT BREAK TOO) I WILL USE IT
<freemo_> oops caps lock
schneider has quit [Ping timeout: 268 seconds]
<havenwood> freemo_: Here's an example of two ways to write the same thing: https://gist.github.com/havenwood/e6787b4f48e277ba7d3a509d5a885da5
<havenwood> oops, forget the :ok in the first one
<havenwood> **fixed
sauvin has joined #ruby
<freemo_> ohhh hmm that is odd but makes some sense
<havenwood> freemo_: Or this goes into the context of self, so you omit it and just `foo` alone: https://gist.github.com/havenwood/e6787b4f48e277ba7d3a509d5a885da5#file-foo-rb-L10-L14
<havenwood> freemo_: So, TL;DR: I'm aliasing a class method.
<havenwood> freemo_: I just wanted to be able to do DoNot[:foo] instead of DoNot.new(:foo)
<havenwood> freemo_: inheriting from Module isn't a common idiom: https://gist.github.com/havenwood/ae6fe35b5d006358c81ad6c3b99c6b21#file-do_not_dump-rb-L1
<freemo_> yea i figured that was the end result just didnt grok why, makes more sense now though :) thanks
<havenwood> freemo_: I'm doing that because I wanted to inherit, but... wanted to expose those ignored ivars from outside the module.
schneider has joined #ruby
<havenwood> freemo_: This is a reaaallly uncommon thing to do.
bkxd has joined #ruby
<freemo_> i didnt even know class could inherit from Module like that, very odd
<havenwood> freemo_: To define an #included on a module is a fairly common pattern: https://gist.github.com/havenwood/ae6fe35b5d006358c81ad6c3b99c6b21#file-do_not_dump-rb-L10
<havenwood> freemo_: Often it's used to define class methods when a module is included.
<havenwood> I then did some weird, contorted class_exec with class variables, because I couldn't think of how to do it cleanly.
<freemo_> i have never used "included" in any context.. but i guess its saying "do this when included"
<havenwood> freemo_: Yup, it's a hook to do something when included, and the `base` is the class instance.
<freemo_> hmm ok
<freemo_> thanks
schneider has quit [Ping timeout: 252 seconds]
<havenwood> Effectively you can ditch all that fanciness insanity by just hardcoding the ignored ivars here: https://gist.github.com/havenwood/54f7eccbb145238994deeb86b2d6fd84#file-safe_serialize-rb-L11
<freemo_> havenwood: want me to try the hardcoded version see if it has the same problem?
<havenwood> freemo_: I'm assuming it does, but seems worth a check.
<freemo_> I would think so too
schneider has joined #ruby
<freemo_> havenwood: yea same problem
<havenwood> freemo_: Same problem if you don't include Wisper at all?
Creatornator has quit [Quit: Textual IRC Client: www.textualapp.com]
duderonomy has joined #ruby
<freemo_> let me see...
<freemo_> havenwood: hmmm, cant just remove whisper without breaking the code in other ways....
Guest43479 has joined #ruby
tris- has joined #ruby
Guest86558 has joined #ruby
<havenwood> ah, right
Biohazard has joined #ruby
<havenwood> freemo_: I'm assuming it'd work without the Whisper include, but I don't know why.
schneider has quit [Ping timeout: 268 seconds]
<freemo_> hmm let me try a little harder to take it out to see...
<freemo_> havenwood: i took out wisper successfully, same error as before now
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood> freemo_: ooh, okay! that narrows it down.
<havenwood> freemo_: Err, wait - is Producer an empty class and it still happens?
<havenwood> freemo_: But the example itself works for you?
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
<havenwood> Or am I just missing the Producer code?
<freemo_> havenwood: i didnt try the example itself
schneider has joined #ruby
<havenwood> freemo_: Maybe try that, because it works for me.
<freemo_> havenwood: producer? you mean publisher?
erratic has joined #ruby
<havenwood> freemo_: yes
<freemo_> havenwood: not sure if it would happen if publisher were empty and i tried to serialize it...hmm need to figure out an easy way to test that
za1b1tsu has quit [Ping timeout: 252 seconds]
<freemo_> let me try your example first
<havenwood> freemo_: If Publisher is empty, and it happens, I then wonder why it's only in the context of the project that an empty class errors. I'd say sanity check the example even works for you (assuming it does).
<freemo_> thats easy
<lunaphyte> i'm hoping someone can help me understand a section of a ruby program i'm trying to use
<lunaphyte> i've been able to make sense of pieces of this, but am not able to work out how to make it print "Disabling ssl host verification"
suukim has joined #ruby
<freemo_> havenwood: running your example as-is gives me this: https://gist.github.com/freemo/f6efed2bc60eec8bdb8c85cb22b19c7e
schneider has quit [Ping timeout: 252 seconds]
<baweaver> lunaphyte: what does the first line say?
<lunaphyte> you mean "unless @config.newrelic"?
<baweaver> yep, right after that part
<havenwood> freemo_: Can you confirm with this smushed together, no errors for examples version?: https://gist.github.com/havenwood/ff1989451fbb0d48b63a1c9ddf22c325
<lunaphyte> i think i understand that part, just from testing - it won't go into the conditional unless ssl_host_verification is present in the config file
<baweaver> bingo
<lunaphyte> line 2 though i don't understand
MoritaShinobu has joined #ruby
<baweaver> !! ?
<baweaver> which part?
<havenwood> baweaver: Getting a boolean from truthiness
<baweaver> It means "not not"
<baweaver> havenwood: Oh I know
<baweaver> I assume that the config shouldn't be quoted either
<lunaphyte> i can get it to go into the conditional - i've done that with testing, but it never prints "Disabling ssl host verification"
<havenwood> baweaver: hah, wrong nick - hi though!
<baweaver> alo
<havenwood> baweaver: you're the same color blue in my irc as lunaphyte at the moment
<baweaver> interesting
<baweaver> ah well
<baweaver> It might be that platform logger isn't logging to console
* havenwood rerolls irc colors
<freemo_> havenwood: the code you just pasted gives me the same error as the last pastebin i shared
<baweaver> duplicate that line and change it to puts instead
<lunaphyte> baweaver: i believe it is - i see other logging from it
<lunaphyte> baweaver: duplicate line 2?
<baweaver> puts "Disabling ssl host verification" unless NewRelic::Binding::Config.ssl_host_verification
<baweaver> Just for kicks
<lunaphyte> oh i see
<baweaver> ah
<baweaver> unless
<baweaver> and the string, got it
schneider has joined #ruby
<baweaver> ssl_host_verification: false
<havenwood> freemo_: try just: ruby bin/testing.rb
<freemo_> ok
<baweaver> is different from: `ssl_host_verification: "false"`
<baweaver> Strings in Ruby are always truthy lunaphyte
<lunaphyte> ah - of course
<freemo_> havenwood: yea that worked
<baweaver> derp on me for not noticing it earlier :P
<lunaphyte> well, it's probably mostly because it's such an inane question :)
asphyxia has quit [Ping timeout: 252 seconds]
<havenwood> freemo_: welp, works in isolation - and doesn't take Wisper to break - so it's gotta be something else - hrmm - this isn't easy to track down
* havenwood peruses the code
<lunaphyte> baweaver: when you said strings are always truthy, that is to say that if there is a string, it evaluates to true, even if the string is, for example, "false"?
asphyxia has joined #ruby
schneider has quit [Ping timeout: 246 seconds]
<baweaver> In Ruby there are two things which are false
<baweaver> falsy rather
<baweaver> false and nil
<baweaver> everything else? Truthy
<freemo_> havenwood: as much as i love ruby my main complaint is that it is always harder to debug
<lunaphyte> so one could make a boolean true with either true or "true", but one can only make a boolean false with false, but not "false"?
<lunaphyte> oh or nil?
<lunaphyte> ok
<havenwood> lunaphyte: Nothing at all, ever is ever falsey other than `nil` and `false`. You can't even make a thing that is. Almost nothing is falsey.
<baweaver> "true" is truthy
<lunaphyte> got it - thanks
<baweaver> havenwood: Well....
nowhere_man has quit [Remote host closed the connection]
<baweaver> There are ways to screw with prefix and equality to do fun things :D
<baweaver> but there be dark magics
nowhere_man has joined #ruby
<havenwood> baweaver: i don't even know how to use Fiddle to make a thing actually falsey
<lunaphyte> so now i'm on to the next issue. i've set ssl_host_verification: false, and the output reflects this ["Disabling ssl host verification
<lunaphyte> "], but the http request still complains "certificate verify failed": https://dpaste.de/Spf2
<lunaphyte> oops, sorry about the feral line feed
schneider has joined #ruby
<lunaphyte> i suppose that's not quite topical for this channel though :)
<havenwood> freemo_: Ah, found it - Gary!
<freemo_> havenwood: hmmm
<havenwood> freemo_: err, or maybe not. at least it's suspicious - Gary mixes in Enumerable, then Inventory inherits from Gary and defined marshal_dump.
<freemo_> havenwood: because it includes Enumerable?
<freemo_> ahh
<freemo_> yea gary does behave like an array
<freemo_> Gary is used a lot in the app
<havenwood> but this wouldn't actually define these for all Enumerable - and you confirmed Array and Hash both exhibit the error...
schneider has quit [Ping timeout: 268 seconds]
<lunaphyte> baweaver, havenwood: thanks for the help and the friendly cluebat - much appreciated
<freemo_> yea
schneider has joined #ruby
<havenwood> freemo_: here's a variant with ::_load and #_dump, just to rule one more thing out: https://gist.github.com/havenwood/2d626a5c81ea293a7b2b91dc51d00d35
jetchisel has joined #ruby
<freemo_> ok
<havenwood> freemo_: Maybe this would show if the issue is really a redefining of #marshal_dump on Array and Hash - unsure!
<havenwood> baweaver: I think I need to stop coding for the day ^ ... It's getting ugly...
<havenwood> class variables? what's happening to me?!?
<freemo_> havenwood: same error
<freemo_> havenwood: lol :)
<havenwood> freemo_: wow, I don't get it!
<freemo_> class variables have their place, but ill admit there arent may good uses for them
<freemo_> havenwood: im useless for debugging this one :(
<freemo_> my only solution is to try a similar approach but rewritten to do it in a less clean way
<havenwood> freemo_: Could you throw a binding.pry in there and check: [].methods.grep(/dump/)
<havenwood> Or: binding.irb
<freemo_> id rather not go that route but i may have to if you dont know what to do
schneider has quit [Ping timeout: 268 seconds]
<freemo_> havenwood: i have no clue how to do that, im a noob
<havenwood> freemo_: do you use IRB or Pry?
asphyxia has quit [Read error: Connection reset by peer]
<havenwood> freemo_: If you're not using Pry, IRB ships with Ruby so that works.
<havenwood> freemo_: You just put an `binding.irb` in the code where you want to jump to debug - then run it.
<freemo_> havenwood: i think irb, thats that command line thing that lets youwrite ruby interactively right? I almost never use it though i mostly run ruby from files
<havenwood> freemo_: I usually debug Ruby from Pry. It makes debugging much more fun.
<havenwood> freemo_: Pry is a gem, you just: gem install pry
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood> freemo_: But yeah - really handy.
<havenwood> ?pry
<ruby[bot]> 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
<freemo_> havenwood: i should learn how to debug ruby properly, until now i just hack it out
<havenwood> freemo_: It's a great way to introspect and find out what's actually happening.
<havenwood> freemo_: This talk goes into more debugging detail than you'll probably need here but worth a watch: https://www.youtube.com/watch?v=D9j_Mf91M0I
<freemo_> havenwood: i certainly will
schneider has joined #ruby
<freemo_> havenwood: although is you want me to debug this code as you asked youll have to step me through exactly what you want me to do, unfortunately im pretty lost here. so just add the text "binding.irb" to some line in my code? what line? then run irb? run it how? ike what command?
<havenwood> freemo_: However you usually reproduce your error.
<havenwood> freemo_: Put a `binding.irb` on line 24 since it's failing on line 25.
<freemo_> ok.. do i add it with the quotes or without?
eckhardt has quit [Quit: Textual IRC Client: www.textualapp.com]
<havenwood> without
<freemo_> ok
<havenwood> just using backticks to show it's code
<havenwood> binding.irb
<freemo_> done
<havenwood> Or add pry to your Gemfile, bundle, add `require 'pry'` and: binding.pry
asphyxia has joined #ruby
<havenwood> freemo_: Now reproduce the error, and instead of it happening it'l jump you to the REPL at line 24.
<havenwood> freemo_: So you can check: [].methods.grep(/dump/)
<freemo_> havenwood: just reproduce it by running it the way i usually do? just call bundler exec ruby ....
<havenwood> freemo_: yup
schneider has quit [Ping timeout: 252 seconds]
<freemo_> ok
<havenwood> [].methods.grep(/dump/) #?> []
<freemo_> havenwood: ohhh this is cool! ok im at the prompt with it stalled at the expected place
<havenwood> freemo_: Yup! And with Pry you can do stuff like: ls []
<havenwood> freemo_: Or even: cd []; ls
apeiros has quit [Remote host closed the connection]
<havenwood> freemo_: With pry-byebug you can also step through the stack.
<freemo_> havenwood: irb(Room(GarbageRoom|439a0844-0085-2a1a-a02b-51fc03617ead)):001:0> [].methods.grep(/dump/) #?> [] .... this gives me the following result... => []
<havenwood> freemo_: Hrmm, so no dump methods defined on an Array instance...
<havenwood> freemo_: So where's that method loop coming from?!
<havenwood> freemo_: Try?: Marshal.dump []
<havenwood> freemo_: Does that ^ reproduce the error?
<freemo_> havenwood: nope when i do that it returns this: => "\x04\b[\x00"
<havenwood> freemo_: Oooh, maybe one of the instance variables is a Producer itself!
<havenwood> freemo_: Great, so marshaling arrays actually works, it's this particular array.
<havenwood> freemo_: Check?: data
<freemo_> havenwood: ohh yes it would be
<havenwood> freemo_: ahhhh, depth
<freemo_> virtually every object in the game needs to be a publisher
schneider has joined #ruby
<havenwood> freemo_: haha, that just didn't occur to me
<freemo_> so an inventory is itself a publisher and all the objects it contains are publishers
<freemo_> :)
<havenwood> freemo_: But we can't limit the depth, because you actually need those all to be serialized - right/
<havenwood> freemo_: Try?: Marshal.dump data, 1
<havenwood> -1 (no depth check) is the default second argument to Marshal::dump
<freemo_> yea
<freemo_> i need everything serialized to infinite depth
<havenwood> freemo_: Hrmmmmmmm
<havenwood> freemo_: I have to run tonight but this is an interesting problem. I'd be happy to look with fresh eyes. I'd probably be more help.
<havenwood> freemo_: Or someone else might be waking up here shortly. :)
<freemo_> havenwood: the last command i tried does produce an exception
<freemo_> havenwood: i should sleep myself, 1am here. if youd like to continue this tomorrow is there a good time to catch you?
<havenwood> freemo_: G'night and good luck! I'm usually around here.
<freemo_> havenwood: alright ill try to look for you tomorrow then
<freemo_> i appreciate all the help
<havenwood> no prob, you're welcome - g'night!
schneider has quit [Ping timeout: 252 seconds]
schneider has joined #ruby
schneider has quit [Ping timeout: 250 seconds]
freemo_ has quit [Ping timeout: 268 seconds]
schneider has joined #ruby
dviola has quit [Quit: WeeChat 2.2]
SuperL4g_ is now known as SuperLag
schneider has quit [Ping timeout: 246 seconds]
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
karapetyan has joined #ruby
karapetyan has quit [Remote host closed the connection]
schneider has joined #ruby
schneider has quit [Ping timeout: 244 seconds]
za1b1tsu has joined #ruby
schneider has joined #ruby
dellavg_ has joined #ruby
schneider has quit [Ping timeout: 250 seconds]
schneider has joined #ruby
bkxd has quit [Ping timeout: 268 seconds]
schneider has quit [Ping timeout: 272 seconds]
karapetyan has joined #ruby
dbz has joined #ruby
schneider has joined #ruby
dbz has quit [Remote host closed the connection]
schneider has quit [Ping timeout: 272 seconds]
savolla has joined #ruby
dbz has joined #ruby
aupadhye has joined #ruby
skwurl has joined #ruby
<skwurl> how can a share variables between methods
<skwurl> ?
<havenwood> skwurl: Instance variables are a common way.
schneider has joined #ruby
<skwurl> would you mind meeting me here if you have a few moments for a small demo please? https://codeshare.io/aywLZe
dbz_ has joined #ruby
dbz has quit [Remote host closed the connection]
<baweaver> skwurl: what's the use case?
<baweaver> What are you trying to do with the code?
schneider has quit [Quit: WeeChat 2.0.1]
<havenwood> skwurl: I responded to your codeshare.
<skwurl> heres a better example of what im actually trying to do.
<skwurl> sorry thank you
<skwurl> i want to use variables outside of the method
<baweaver> you can't
<havenwood> skwurl: Local variables are local to the method.
<havenwood> skwurl: Show us the real code you're working with?
<baweaver> Now, what are you trying to do
<baweaver> Not in the code, but with the code
<baweaver> The more vague you are about the actual code the less help we can really be
<baweaver> Aha, DND
<skwurl> simple character generator. but it doesnt feel quite right
<baweaver> You're conflating a lot of ideas
<baweaver> Functions should be pure, one input and one output
<baweaver> Are you trying to roll dice?
<baweaver> Also global variables are now off limits to you
<skwurl> no this is an rpg called dungeon squad. my kids really like it. No dice rolling. trying to randomly assign a string to a variable to be put in a database.
<skwurl> lol.
<baweaver> What do the text files look like?
<skwurl> it works? X )
<baweaver> you end up reading the entire file in for one value
<baweaver> Random names
<skwurl> thats the names.
<baweaver> So all those text files are basically just lists you want to generate a random set of input from?
<skwurl> random waepons at the bottom etc.
<baweaver> So does stuffgen do roughly the same?
<baweaver> or are those dice rolls?
<skwurl> yes. a random string essentially
<baweaver> Considering the D10?
<baweaver> 10 characters long or how are they defined?
<baweaver> Might be able to do it inline
savolla has quit [Remote host closed the connection]
<skwurl> http://www.1km1kt.net/rpg/dungeon_squad.pdf heres the rules to the actual game if your interested.
<skwurl> no dice rolls. let me explain.
<skwurl> $ctype is an array holding 3 strings
<baweaver> Mind I only ask because it'll help us help you a bit better.
<skwurl> this is in the ctypegen method
<baweaver> you should name them better
<baweaver> ctype doesn't reveal the intent
<skwurl> certianly, i really appreciate it.
bkxd has joined #ruby
arescorpio has joined #ruby
<skwurl> $d4 is a variable defined by randomly slecting a string from the array
<skwurl> it then removes that string from the array to prep for the next.
arescorpio has quit [Remote host closed the connection]
<baweaver> Shuffle is fun.
<skwurl> ctype is character type. d4 d10 d12 are assigned either warrior wizard or explorer to which skill checks are performed in game depending on the nature of the challenge.
<skwurl> it is! shuffle? is that another method?
schleppel has joined #ruby
<baweaver> yep
<baweaver> So assuming things can only be used once, you can instantiate lists of those and shuffle them
<baweaver> or rather: File.readlines(x).shuffle
<skwurl> oh cool!
<baweaver> Now then, code.
<baweaver> one moment, hopping over there
<skwurl> so i want to re-write this from scratch but without gloabl variables.
jetchisel has quit [Ping timeout: 245 seconds]
jetchisel has joined #ruby
ozzloy has joined #ruby
stoffus has joined #ruby
snickers has joined #ruby
arescorpio has joined #ruby
LiftLeft2 has quit [Ping timeout: 252 seconds]
printercu has joined #ruby
<skwurl> so i can pass @@avaraible anywhere in a class right
<baweaver> don't
<baweaver> good habits, not bad ones.
andikr has joined #ruby
<skwurl> i thinnk i have the order backwards in my head.
<baweaver> FIle IO should be as far outside of a class as possible
<baweaver> IO is state mutation, and you want to keep that to the outside as much as possible
<baweaver> It makes code far easier to test, reason about, and build upon later.
<skwurl> right instead of passing stuff out of a method pas it into it
<baweaver> Not necessarily
<baweaver> A function or rather a method should have an input and an output
<baweaver> File IO and things like puts are an additional vector
<baweaver> So you want to avoid them where possible
aufi has joined #ruby
printerc_ has joined #ruby
<baweaver> There are reasons for this
printercu has quit [Read error: Connection reset by peer]
<baweaver> Mostly around dependency injection later on
Fusl has quit [Excess Flood]
printercu has joined #ruby
<skwurl> i alwasy see the initialize method at the start of the class. is the name of this method important?
<baweaver> yes.
<baweaver> Initialize is how you create an instance of a class
<baweaver> Though this may be advanced for you at this point
<skwurl> i think this is what i am missing
Fusl has joined #ruby
<baweaver> Read Practical Object Oriented Programming in Ruby
<skwurl> omw now.
LiftLeft2 has joined #ruby
printerc_ has quit [Ping timeout: 244 seconds]
aufi has quit [Ping timeout: 250 seconds]
DTZUZO_ has quit [Ping timeout: 244 seconds]
aufi has joined #ruby
za1b1tsu has quit [Ping timeout: 252 seconds]
aufi has quit [Read error: Connection reset by peer]
za1b1tsu has joined #ruby
<printercu> Hi there! Does anybody know if net/http client is thread-safe? I mean if I have single client = Net::HTTP.new(...) is it safe to call client.request(...) multiple times concurrently?
skwurl has quit [Quit: WeeChat 2.2]
alem0lars has joined #ruby
clemens3_ has joined #ruby
arescorpio has quit [Remote host closed the connection]
sariyar has joined #ruby
duderonomy has joined #ruby
za1b1tsu has quit [Ping timeout: 244 seconds]
duderono_ has joined #ruby
duderonomy has quit [Read error: Connection reset by peer]
duderono_ has quit [Client Quit]
duderonomy has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ivanskie has joined #ruby
nadir has quit [Quit: Connection closed for inactivity]
bzf- has joined #ruby
za1b1tsu has joined #ruby
dbz_ has quit [Remote host closed the connection]
Ag3nt has joined #ruby
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
za1b1tsu has quit [Ping timeout: 244 seconds]
bga57 has quit [Ping timeout: 272 seconds]
roshanavand has joined #ruby
teclator has joined #ruby
schleppel has quit [Quit: Konversation terminated!]
tj_ has joined #ruby
<tj_> Hi folks, anyone using VS Code with ruby ? I have problems while passing arguments to Vscode (there are program arguments and interpreter arguments)
lxsameer has joined #ruby
<tj_> I want to use a debugger for debugging my ruby code
johnny56 has joined #ruby
<tj_> order of passing arguments --> ruby.exe [ interpreter arguments like -v -w -I ] [ programfile.rb ] [ program arguments ... ]
code_zombie has quit [Quit: Leaving]
venmx has joined #ruby
<ruby[bot]> tj_: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
bga57 has joined #ruby
<tj_> VS Code gives an args[] array to pass the arguments. I have pasted my launch.json here https://pastebin.com/CCJs0vXs
<ruby[bot]> tj_: as I told you already, please use https://gist.github.com
<tj_> okay
<tj_> sure
<tj_> I would keep that in mind
<tj_> But please consider the given pastebin link for this one time.
za1b1tsu has joined #ruby
<tj_> in args[] section in given json file. I have passed the arguments. but it doesn't follow the order of passing arguments
<tj_> it violets the order of passing args order of passing arguments --> ruby.exe [ interpreter arguments like -v -w -I ] [ programfile.rb ] [ program arguments ... ]
marz_d`ghostman has joined #ruby
<marz_d`ghostman> I forgot what it is called in Java, but there's a mechanism where they use constants as a value that they pass anywhere. Is there a similar mechanism in ruby? Like Database::Status::SUCCESSFUL?
karapetyan has quit [Remote host closed the connection]
<tj_> I am not sure. I get "require" error that it cannot find required files
printercu has quit []
phaul has joined #ruby
karapetyan has joined #ruby
<marz_d`ghostman> I remember it, it's called enum
za1b1tsu has quit [Ping timeout: 252 seconds]
<tj_> Enum wouldn't help here
bkxd has quit [Ping timeout: 246 seconds]
<phaul> https://gist.github.com/phaul/8fd6caeb4c6611958fde4119891a291f does anyone have a clue why this sequel query dies with .count but works with .first?
Asher has joined #ruby
dous has joined #ruby
Asher has quit [Ping timeout: 250 seconds]
c0ncealed3 has quit [Remote host closed the connection]
mikecmpbll has joined #ruby
c0ncealed3 has joined #ruby
xfbs has joined #ruby
_whitelogger has joined #ruby
jetchisel has quit [Ping timeout: 252 seconds]
xfbs has quit [Quit: afk]
ansraliant has quit [Quit: My planet needs me]
apeiros has joined #ruby
vutral has joined #ruby
<marz_d`ghostman> I have a class method that invokes multiple private methods. When testing it in rspec, cop telss me that my describe block has too many lines.
<marz_d`ghostman> Should I test every method instead of the one class method with multiple context?
bkxd has joined #ruby
<phaul> I found a way, ... sequel has so many gotchas.
xfbs has joined #ruby
bkxd has quit [Ping timeout: 252 seconds]
apeiros has quit [Ping timeout: 250 seconds]
bkxd has joined #ruby
gell5 has joined #ruby
MaiconVieira has quit [Remote host closed the connection]
tj_ has quit [Remote host closed the connection]
n13z has quit [Ping timeout: 252 seconds]
apeiros has joined #ruby
troulouliou_div2 has joined #ruby
<apeiros> phaul: personally I've stopped doing anything remotely complex in ORMs (or even just "query mappers"). I'll resort to db views rather quickly so I can keep the code side simple.
<apeiros> the moment I have joins or aliases f.ex. -> db view
n13z has joined #ruby
<phaul> apeiros: fair enough
silviu has joined #ruby
<phaul> tbh I have 0 experience with sequel but slowly getting the hang of it
rapha has joined #ruby
<rapha> hi
yqt has joined #ruby
<rapha> is there anything for ruby that will allow you to do what's suggested in that answer, i.e. "fitting data to a distribution"?
<apeiros> that's a statistical problem first, and once you've found which statistical tool you want to use, it's a programmatic/algorithmic problem second.
<apeiros> in core ruby, there are no statistical tools, no.
<apeiros> but there are almost certainly gems which provide you with methods to perform analytic queries on data series.
za1b1tsu_ has joined #ruby
akem has quit [Remote host closed the connection]
akem has joined #ruby
zapata has quit [Quit: WeeChat 2.2]
<Bish> phaul: sequel <3
<Bish> there is #sequel, too
<Bish> btw
<rapha> apeiros: reading! thank you!!
<phaul> Bish: weird, I checked with alis, and it doesn't seem to know about it. /msg alis list sequel
<marz_d`ghostman> If the code under test calls `exit`, the rest of the tests are not run in rspec. How do I get around that?
<apeiros> stub it
<apeiros> also don't call exit in your code :-p
<marz_d`ghostman> apeiros: But I'm testing a case where my code fails and not continue, hence I have exit in my code :)
<Bish> phaul: tf is alis
<apeiros> code failing is no reason to call exit
<Bish> oh u explain it right there :D
<marz_d`ghostman> apeiros: Okay how about this, I have a pre_process() method that needs to run before main_process(). If the pre_process() isn't successful, it logs/updates db status and should not continue with running main_process()
<apeiros> almost exclusively the only place to call exit is in the scope of the executable. and the executable itself should be minimal. like: shebang line, require main library, call into main library, exit.
bkxd has quit [Ping timeout: 276 seconds]
<apeiros> marz_d`ghostman: you can do all of that without a single exit.
bkxd has joined #ruby
<apeiros> you make reasoning about code a lot easier if you have single entry & exit points. calling exit in the middle is like calling return in the middle. it's spaghetti and makes reading & reasoning about your code harder. usually without any gain.
* apeiros afk, back in ~30min
tj_ has joined #ruby
<marz_d`ghostman> apeiros: so If I have a method run() { pre_process(); main_process() } how do I terminate if pre_process does not succeed?
lxsameer has quit [Ping timeout: 252 seconds]
esrse has quit [Ping timeout: 244 seconds]
<rapha> apeiros: looking at my data, it seems the OPTICS algorithm might be a good choice. And luckily, as you predicted, ta-daaa: https://github.com/ebakan/clustering
<rapha> (well, not a Gem, but good enough!)
tdy has quit [Ping timeout: 252 seconds]
bkxd has quit [Ping timeout: 250 seconds]
apeiros has quit [Ping timeout: 252 seconds]
EnderMB has joined #ruby
EnderMB has left #ruby [#ruby]
lxsameer has joined #ruby
kurko_ has joined #ruby
jetchisel has joined #ruby
Francisco has joined #ruby
lxsameer has quit [Ping timeout: 276 seconds]
Fr4n has quit [Read error: Connection reset by peer]
gheegh has joined #ruby
KeyJoo has joined #ruby
prillian5 has joined #ruby
apeiros has joined #ruby
<apeiros> rapha: cool!
<apeiros> marz_d`ghostman: well, how do you usually let ruby *not* execute a piece of code you don't want to execute because something is or something happened?
<apeiros> or rather, your framing "how do I *terminate*" is wrong.
karapetyan has quit [Remote host closed the connection]
bkxd has joined #ruby
karapetyan has joined #ruby
<marz_d`ghostman> apeiros: I'm having problems testing my private methods, hence, I've made all of them public. But I don't think this is good practice though
<prillian5> Hi, I'm a ruby noob. I have to adjust now a short script, which search and replace something in a given file. http://dpaste.com/3YBXQVG
<apeiros> I'm not sure - was that supposed to be an answer to my question? o0
schleppel has joined #ruby
<apeiros> hi prillian5
<prillian5> This works nice, but now I have to replace the Version-Code of "version": "0.2.1" and I try to figure out how.
<prillian5> @apeiros hi
paraxial has joined #ruby
<apeiros> prillian5: somehow I don't think that this works at all… I'd bet that line 3 raises an exception.
<prillian5> Ah yes, sorry this line was only a try I forget to remove.
bkxd has quit [Ping timeout: 252 seconds]
<apeiros> prillian5: try to phrase in words how a valid version number you'd want to match can look
<prillian5> I wonder how to search for "version" ... must I escape " like this: re = /\"version\"\:\s+(\d\.\d\.\d)/
<apeiros> right now your expression says "a version number is one or more digits"
<marz_d`ghostman> How do you best test a class like this? https://gist.github.com/marzdgzmn/a3eb4baafccc8edb898eb6282082b2e9
<apeiros> marz_d`ghostman: sooo… skipping my question entirely?
tdy has joined #ruby
bkxd has joined #ruby
<apeiros> prillian5: yes, that will match e.g. "\"version\": 1.2.3"
<apeiros> it won't match "version: 1.2.3", it won't match "version: 1.15.2", and it won't match "version: 1.2"
<marz_d`ghostman> apeiros: oh sorry wasn't able to notice that. Hmmm, so what I did was I have a method like pre_cmd() where I run cmd and rescue Errno::ENOENT, then log and update db. I just transferred the rescue block to the main method
<prillian5> @apeiros : thats no problem, the version here is all the time exactly the same schema.
<prillian5> 1.3.5 or 1.12.2 and so on
<apeiros> prillian5: 1.12.2 is in my list of non-matches, though
<apeiros> \d <-- exactly one digit
<apeiros> \d+ <-- one or more digits
<prillian5> ok, have to go for half an our, Will be back later. Thank you so far
<apeiros> kk, cya
bmurt has joined #ruby
za1b1tsu_ has quit [Ping timeout: 276 seconds]
bmurt has quit [Client Quit]
prillian5 has quit [Ping timeout: 252 seconds]
tj_ has quit [Ping timeout: 252 seconds]
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
lxsameer has joined #ruby
ldnunes has joined #ruby
bkxd has quit [Ping timeout: 252 seconds]
lxsameer has quit [Ping timeout: 276 seconds]
KeyJoo has quit [Read error: Connection reset by peer]
dionysus69 has quit [Ping timeout: 268 seconds]
KeyJoo has joined #ruby
dionysus69 has joined #ruby
za1b1tsu_ has joined #ruby
dionysus69_ has joined #ruby
tdy has quit [Ping timeout: 276 seconds]
dionysus69 has quit [Ping timeout: 250 seconds]
dionysus69_ is now known as dionysus69
mn3m has joined #ruby
prillian5 has joined #ruby
mn3m has quit [Max SendQ exceeded]
jcalla has joined #ruby
Chetic has joined #ruby
dionysus69_ has joined #ruby
<Chetic> my .rb file has a line with require "P4.so" and calls self.run(). Is there a possibility that self.run() calls a run function in P4.so?
KeyJoo has quit [Remote host closed the connection]
prillian5 has quit [Quit: Konversation terminated!]
dionysus69_ is now known as dionysus69
dionysus69 has quit [Ping timeout: 244 seconds]
<Chetic> stack trace ends at "P4.rb:131:in `run'" even though P4.rb does not have a run function
ta_ has joined #ruby
bkxd has joined #ruby
lxsameer has joined #ruby
Chetic is now known as alarm1
alarm1 is now known as Chetic
lxsameer has quit [Ping timeout: 250 seconds]
lxsameer has joined #ruby
GodFather has joined #ruby
karapetyan has quit [Remote host closed the connection]
ta_ has quit [Remote host closed the connection]
karapetyan has joined #ruby
kurko_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
GodFather has quit [Ping timeout: 260 seconds]
suukim has quit [Quit: Konversation terminated!]
asphyxia is now known as kogumanomisha
GodFather has joined #ruby
kogumanomisha is now known as asphyxia
InfinityFye has joined #ruby
cow[moo] has joined #ruby
bmurt has joined #ruby
Ag3nt has quit [Quit: leaving]
GodFather has quit [Ping timeout: 252 seconds]
DTZUZO_ has joined #ruby
Asher has joined #ruby
donofrio has quit [Remote host closed the connection]
madsj has joined #ruby
vondruch has quit [Ping timeout: 244 seconds]
MaiconVieira has joined #ruby
<apeiros> Chetic: yes
kurko_ has joined #ruby
Asher has quit [Ping timeout: 276 seconds]
<Chetic> any tips on how to figure out what's wrong?
GodFather has joined #ruby
<apeiros> .so is a native extension. most often written in C, and it can define methods callable from ruby
<apeiros> with the given information? all I can tell you "read the exception and go from there".
<Chetic> there is no run function declared in the .so-file though
<Chetic> but maybe there's some mapping in-between?
<apeiros> if you don't have access to the source, your options are limited to docs, though.
<Chetic> the exception just says "[P4#run] Errors during command execution( "p4 users" )"
<apeiros> how do you figure that there's no run-function in the .so file?
<Chetic> objdump -Ct P4.so | grep run
<apeiros> ok, I don't know how objdump's output maps with how methods are linked with the C code. so can't help with that.
<apeiros> if you have the source, it'll read something along rb_define_method
<Chetic> it lists and demangles all symbols
<Chetic> ok
<apeiros> the C symbol afaik doesn't have to have the same name as the method exposed in ruby
<Chetic> where is the mapping stored then?
snickers has quit [Ping timeout: 244 seconds]
<apeiros> as you can do e.g. rb_define_module_function(cP4, "run", your_c_function, argc)
GodFather has quit [Ping timeout: 276 seconds]
<apeiros> I don't know where that information will end up in the .so
<Chetic> wouldn't that end up in the .so-file though
<apeiros> in some way sure. but I think only your_c_function ends up as a symbol
<apeiros> I don't know where/how cP4 + "run" ends up
<Chetic> hrm yeah maybe the mapping is mangled somehow
<apeiros> (assumes cP4 = rb_define_class(…))
<apeiros> or rb_define_module if it's a module
<Chetic> I'm looking at the source
<Chetic> with mappings
<apeiros> the "run" certaily ends up in ruby's symbol table (Symbol.all_symbols), but where/how that's stored in the .so - as said, no idea.
<apeiros> with the source as said, search for rb_define_module_function
<apeiros> unless P4 is neither a class nor a module.
<apeiros> then it'd just be rb_define_method iirc
<apeiros> oh, could also be rb_define_singleton_method
<apeiros> aaaah, I think rb_module_function is effectively what `module_function def foo` in ruby code does. so that one is less likely than singleton_method.
* apeiros afk for a bit
apeiros has quit []
uplime has quit [Ping timeout: 252 seconds]
dmitch has joined #ruby
mhb has joined #ruby
GodFather has joined #ruby
elcontrastador has joined #ruby
tdy has joined #ruby
fluxAeon has joined #ruby
GodFather has quit [Ping timeout: 250 seconds]
Asher has joined #ruby
Rapture has joined #ruby
aupadhye has quit [Quit: Leaving]
Asher has quit [Ping timeout: 252 seconds]
tj_ has joined #ruby
apeiros_ has joined #ruby
madsj has quit [Quit: Lost terminal]
stoffus has quit [Ping timeout: 245 seconds]
noodle has quit [Ping timeout: 264 seconds]
stoffus has joined #ruby
za1b1tsu_ has quit [Ping timeout: 252 seconds]
nadir has joined #ruby
tj_ has quit [Remote host closed the connection]
justicefries has joined #ruby
stoffus has quit [Quit: leaving]
ivanskie has joined #ruby
noodle has joined #ruby
cow[moo] has quit [Ping timeout: 246 seconds]
orbyt_ has joined #ruby
justicefries has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
justicefries has joined #ruby
ruby462 has joined #ruby
tdy has quit [Ping timeout: 252 seconds]
reber has joined #ruby
sgen has joined #ruby
clemens3_ has quit [Remote host closed the connection]
sgen has quit [Max SendQ exceeded]
sgen has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
freemo_ has joined #ruby
kujira has quit []
clemens3_ has joined #ruby
uplime has joined #ruby
za1b1tsu_ has joined #ruby
alem0lars has quit [Ping timeout: 272 seconds]
freemo_ has quit [Changing host]
freemo_ has joined #ruby
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<freemo_> hello everyone. I had a problem last night that havenwood was trying to work me through. He offered a solution, but it had a bug, we figured out why the bug was there but he had to go to sleep and we couldnt do a fix. Im a bit of a noob so im having trouble undersanding the issue myself or how to fix it. One sec I'll post the code itself and try to explain...
za1b1tsu_ has quit [Ping timeout: 252 seconds]
<freemo_> This is the offending code (and the code we added with havenwood 's help): https://github.com/Syncleus/Aethyr/blob/broken/lib/aethyr/core/util/publisher.rb
<freemo_> What we are trying to do is get serialization to work such that certain instance variables are ignored (since they cant serialize)
<freemo_> the issue is that objects being serialized also contain other objects that also need to be serialized.. this recursive nature is the reason it breaks it seems (the error is a very long stack trace of the same line over and over)
<freemo_> So with that said, anyone have any ideas what to do?
<apeiros_> oh wow, havenwood used class variables?
Francisco has quit [Quit: Francisco]
<apeiros_> not sure why you use included hook instead of defining the methods and use extend…
<apeiros_> well… got to run in ~5min, so I'm probably not able to help.
apeiros_ has quit []
Asher has joined #ruby
kurko_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
polishdub has joined #ruby
Asher has quit [Ping timeout: 245 seconds]
chouhoulis has joined #ruby
chouhoulis has quit [Remote host closed the connection]
chouhoulis has joined #ruby
jackson has joined #ruby
jackson is now known as Guest90026
troulouliou_div2 has quit [Read error: Connection reset by peer]
DTZUZO_ has quit [Ping timeout: 276 seconds]
za1b1tsu_ has joined #ruby
clemens3_ has quit [Ping timeout: 244 seconds]
gheegh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
za1b1tsu_ has quit [Ping timeout: 246 seconds]
desperek has joined #ruby
samort7 has joined #ruby
<samort7> I know it is a bit overkill, but anyone ever use Rails for just a basic personal website?
snickers has joined #ruby
jcarl43 has joined #ruby
apeiros_ has joined #ruby
<apeiros_> samort7: sure. why not.
<samort7> apeiros_, alright neat :)
apeiros_ is now known as apeiros
<Eiam> samort7: take a look at Sinatra?
<Eiam> way less magic and overhead than Rails
<Eiam> not that rails cannot do it, just cognitive load for me. I used to use Rails, these days I try to keep it simple with sinatra
<samort7> Eiam: It's just that I am now finishing Hartle's Rails tutorial and wanted something to work on while I brainstorm bigger and better project ideas.
<Eiam> well, good reason to use Rails then =)
<samort7> Eiam: :)
andikr has quit [Remote host closed the connection]
gheegh has joined #ruby
nahra has joined #ruby
swoorup has joined #ruby
<freemo_> apeiros: yea havenwood is the one who wrote that, i only partially understand what is going on
<freemo_> So anyone have any ideas on how to address my problem
<apeiros> he must have had a good reason :)
Eiam has quit [Quit: Textual IRC Client: www.textualapp.com]
<apeiros> freemo_: I'd need a reproducible example. but I'm only here for a moment, that's why I said before I'll likely not be very helpful :-|
<freemo_> apeiros: well you can run the code to reproduce the error, but it probably isnt too hard to write a minamilist example (I can try). it would just need a member variable to contain a serializable object
rippa has joined #ruby
<apeiros> freemo_: eh, no, I can't run that code. I don't have Whisper.
Dbugger has joined #ruby
<havenwood> apeiros: Seriously, what was I thinking? Yesterday was a long day, but I didn't realize I was so far gone that I'd start using class variables... ¯\_(ツ)_/¯
<apeiros> *Wisper
<apeiros> havenwood: 17:40 apeiros: he must have had a good reason :)
<apeiros> see, I trust you! :D
<havenwood> haha
<freemo_> havenwood: you gotta admit that while class variables should be a very rare occurance there are some scenarios where it makes sense. Most of which are cases where the class variables are static (like this one)
<apeiros> anyway, got to get some extreeeemely slow query to run now and then run myself some ~5 miles
<apeiros> why did I use miles? fuck miles. km ftw.
<havenwood> freemo_: So the issue we left off with was the Producers themselves have Producers (is that the right word, I remember it starts with "P")
<havenwood> freemo_: And it's serializing to too deep a depth and overflowing the stack, right?
<freemo_> havenwood: I think you mean "Publisher" not "Producer" .. unless producer has a technical meaning here im unaware of
<havenwood> Yes, Publisher.
<apeiros> freemo_: you realize tho that class variables are shared across the ancestry, yes?
<havenwood> freemo_: No, I just can't remember words. Starts with "P" and ends with "r" are all the same word to my brain. >.>
<apeiros> and in a rather funky way with regards to where they are cut off (first seen first cut-off)
DTZUZO_ has joined #ruby
<freemo_> apeiros: well i havent used them much in ruby yet, but it would seem that in this case that is exactly what youd want, since a child of a class would still ignore the same stuff as the parent. So you'd want the hierarchy to have it
<havenwood> freemo_: If each Publisher has Publishers, how deep does it go?
<freemo_> havenwood: but im not sure the issue is "too deep".. because with my code while it would be recursive the depth would only be a few dozen levels at most.. but the call looks like it is recursive down hundreds of levels, and i doubt thats the case here
<apeiros> freemo_: but the parents might not want to ignore the stuff children added…
<apeiros> and they will. because it doesn't matter where in the ancestry you modify it. it'll be shared across all, all the same.
<havenwood> freemo_: It needs to serialize the publishers of the publishers too though, right?
<freemo_> havenwood: there is no set limit to how deep it would go. In practice usually just a few levels down. though in reality nothing is stopping it from going deeper
karapetyan has quit [Remote host closed the connection]
<freemo_> havenwood: yes it needs to serialize as deep as it goes
<havenwood> freemo_: How many publishers of publishers are there? Is that the hundreds?
elcontrastador has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<freemo_> So everything in the game are either objects that cant contain things or objects that can. For example an area contains rooms, rooms contain people, people contain inventory, inventory contains bags, bags can contain other bags, and those bags can have objects
<havenwood> freemo_: Serializing nested things that themselves have nested things that themselves have nested things and so on can get pretty deep.
<freemo_> so just depends on who placed what in what and how many levels deep it goes
karapetyan has joined #ruby
<havenwood> freemo_: hmm.
<freemo_> right now it shouldnt be more than a few levels deep though cause its a starter world im testing on (one room in one area with one guy in it and one sword).. so probably the error we are seeing is after about 6 levels of recursion or so
<freemo_> but once the game goes live there could be dozens of levels of recursion
<freemo_> but not at the depth we are seeing (which looks like hundreds)
ivanskie has joined #ruby
<havenwood> freemo_: I don't have time to look at Wisper at the moment, but I'm curious what's going on.
elcontrastador has joined #ruby
<freemo_> havenwood: it isnt wisper related, if you recall even if we remove wisper the issue still occured
<havenwood> freemo_: What's your Publisher code left after removing the Wisper mixin?
<havenwood> freemo_: Where's that class defined? There's got to be more than an empty class right, or it'd work like the example.
<havenwood> freemo_: I forgot you reproduced it after removing Wisper, but that doesn't make sense!
<freemo_> havenwood: well the publisher itself is empty (other than the include of your class) once i remove wisper. But that in turn was included by game_object and manager... and every object in the game extends from game_object
<freemo_> so quite a bit
<freemo_> in this case its the inventory class that is offending
<freemo_> which has its own marshal calls
<freemo_> which i suspect is where the problem is
<havenwood> freemo_: Can you link us to that class? Sounds like a culprit.
<freemo_> inventory has its own marshal call, and inventory includes Publisher, which itseld redefined marshal
<freemo_> sure
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<freemo_> havenwood: so inventory extends from game_object (which includes publisher). here is the inventory code (which has marshal methods): https://github.com/Syncleus/Aethyr/blob/broken/lib/aethyr/core/objects/inventory.rb
mostlybadfly has joined #ruby
tdy has joined #ruby
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
swoorup has quit [Remote host closed the connection]
<havenwood> freemo_: could you link the error one more time?
<freemo_> sure thing
<freemo_> havenwood: https://pastebin.com/VVi6WnAV
<ruby[bot]> freemo_: as I told you already, please use https://gist.github.com
<freemo_> damnit ruby bot I was resharing the same link upon request ::scowls::
suukim has joined #ruby
DTZUZO has joined #ruby
DTZUZO_ has quit [Ping timeout: 268 seconds]
duderonomy has joined #ruby
<havenwood> freemo_: binding.irb in and try?: Marshal.dump data.first
teej has joined #ruby
lxsameer has quit [Ping timeout: 250 seconds]
ivanskie has joined #ruby
MaiconVieira has quit [Remote host closed the connection]
darkhanb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<freemo_> havenwood: same spot we had it before right? ok...
<havenwood> freemo_: Yeah, just trying to get some insights into which ivars are causing this.
<freemo_> havenwood: that appears to have worked, the output was as follows: => "\x04\b[\a:\n@infoU:\tInfo{\a:\nflags{\x00:\fterrainU;\x06{\b:\findoors0:\rswimming0:\ttype0"
<havenwood> freemo_: see if you can find which part of data fails?
<havenwood> freemo_: Marshal.dump data[1]
<freemo_> havenwood: just do the dump command and use different indexes till it fails?
swoorup has joined #ruby
jrafanie has joined #ruby
<havenwood> freemo_: Yeah, you could do it programmatically if there are many indexes. I think visibility on what exactly is causing this loop will help.
<freemo_> havenwood: yup, im up to index 17 still not failure... ill keep trying...
<freemo_> havenwood: i dont think any of the indexes failed...
<havenwood> freemo_: But it does fail if you?: Marshal.dump data
<freemo_> havenwood: correct me if im wrong but the output from those last few indexes suggests im past the end of the array?
clemens3_ has joined #ruby
<freemo_> havenwood: nope that command (no index) doesnt fail either
crankharder has quit [Remote host closed the connection]
<havenwood> freemo_: Check?: data.size
<freemo_> havenwood: however if i do Marshal.dum data, 1 then it DOES fail
<freemo_> but if i drop the , 1 then it does not fail
<havenwood> freemo_: Well, if it doesn't fail, I guess this time it's serializing it works...
<freemo_> havenwood: yea the size is 22
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood> freemo_: So this isn't the bad marshal, heh.
<havenwood> freemo_: If you `exit` do you get another one?
<havenwood> I can't remember how binding.irb works.
<freemo_> havenwood: ahhh yea thzt makes sense as it probably marshals several objects successfully till it gets to the failing one
<havenwood> freemo_: Aye
<havenwood> We need to find the failing one.
<havenwood> freemo_: There's a nifty gem called pry-rescue that starts the REPL where it failed.
<freemo_> havenwood: im not opposed to using it, though i cant say i know how... hmm
<havenwood> freemo_: I think Pry is worth learning. YMMV
<freemo_> i agree, id like to know how to debug better
<havenwood> freemo_: Can you go onto the next error with IRB, I can't recall.
<havenwood> The binding.irb thing is a new feature, and I'm a Pry user so I never really check it out.
<freemo_> let me try
crankharder has joined #ruby
<freemo_> havenwood: the irb command doesnt seem to have done what you intended, see for yourself: https://gist.github.com/freemo/2d311d6c7ba2a2f5409cbe5bf3cbf307
<freemo_> havenwood: i could maybe just not create the object that is succeeding... then the first one it hits may be the failing one (since there are only two rooms and the first one it tries to serialize is the empty one)
<freemo_> let me try that.
<freemo_> havenwood: oh wait i figured it out
<freemo_> havenwood: if you do "quit" then instead of quiting it just goes to the next binding
sarmiena_ has joined #ruby
<freemo_> havenwood: ok i think i found the offending object (though the behavior is kinda weird
<freemo_> havenwood: so once i get to this object if i try to dump the data then it just puts me back at a new binding. Which is the behavior i think id expect if this thing was infinitely recursive: https://gist.github.com/freemo/e3de4e6ad796118f68cbf4123c2c3686
KrzaQ has quit [Ping timeout: 268 seconds]
mikecmpbll has quit [Quit: inabit. zz.]
funnel_ has joined #ruby
swoorup has quit [Remote host closed the connection]
MoritaShinobu has quit [Quit: Leaving]
duderonomy has joined #ruby
darkhanb has joined #ruby
clemens3 has joined #ruby
swoorup has joined #ruby
clemens3_ has quit [Ping timeout: 245 seconds]
funnel has quit [Remote host closed the connection]
funnel_ is now known as funnel
KrzaQ has joined #ruby
swoorup has quit [Remote host closed the connection]
venmx has quit [Ping timeout: 252 seconds]
swoorup has joined #ruby
swoorup has quit [Remote host closed the connection]
yqt has quit [Ping timeout: 268 seconds]
Guest90026 has quit [Quit: Lost terminal]
swoorup has joined #ruby
nowhereman_ has joined #ruby
nowhere_man has quit [Read error: Connection reset by peer]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
swoorup has quit [Remote host closed the connection]
swoorup has joined #ruby
Boboo has joined #ruby
Boboo has quit [K-Lined]
nowhereman_ has quit [Ping timeout: 252 seconds]
<freemo_> hmm still kinda confused on how to fix this even though i found the offending object... hmmm
za1b1tsu_ has joined #ruby
<havenwood> freemo_: What was the offending object?
<freemo_> havenwood: its the mobile object (i can link it)
oncall-pokemon has joined #ruby
crankharder has quit [Remote host closed the connection]
za1b1tsu_ has quit [Ping timeout: 260 seconds]
jrafanie has quit [Quit: Textual IRC Client: www.textualapp.com]
<freemo_> havenwood: interestingly i dont think the mobile should actually have anything in its inventory
sauvin has quit [Read error: Connection reset by peer]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<freemo_> havenwood: i think i found the issue, though im not clear why your code produces the bug whereas the old way of serializing did not
<freemo_> havenwood: maybe the built0in serialization method is smart enough to not go recursive
<freemo_> havenwood: but yea pretty sure i see what the problem is at least, just not how to fix it
kurko_ has joined #ruby
bmurt has joined #ruby
alem0lars has joined #ruby
akaiiro has quit [Ping timeout: 252 seconds]
dmitch has quit [Ping timeout: 260 seconds]
vondruch has joined #ruby
vondruch has quit [Remote host closed the connection]
Boboo has joined #ruby
Boboo has quit [Client Quit]
gell5 has quit [Read error: Connection reset by peer]
vondruch has joined #ruby
gell5 has joined #ruby
swoorup has quit [Read error: Connection reset by peer]
<freemo_> havenwood: I fixed it! (well sorta/mostly)
<freemo_> just gotta fix some unrelated stuff that was effected
<freemo_> but yea its fixed :)
chouhoul_ has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dviola has joined #ruby
<havenwood> freemo_: nice!
chouhoulis has quit [Ping timeout: 245 seconds]
<freemo_> havenwood: i still think ill need to redesign a lot of this approach though. But it is a good start, thanks so much
<freemo_> havenwood: the issue was that a mobile contained a reactor and the reactor contained a reference back to the mobile.
MaiconVieira has joined #ruby
dous has quit [Ping timeout: 264 seconds]
<havenwood> freemo_: oooh
<havenwood> that explain the looping
surrounder has quit [Ping timeout: 264 seconds]
dous has joined #ruby
<havenwood> explains*
surrounder has joined #ruby
bmurt has joined #ruby
<freemo_> yup
<freemo_> havenwood: i think the default marshaller is smart enough to handle that gracefully.. just need to figure out how to implement that ntelligence in our own method
<havenwood> freemo_: Without including the marshaling module, can you actually marshal the offending object directly with?: Marshal.dump
<freemo_> havenwood: yup
claudiuinberlin has joined #ruby
Asher has joined #ruby
jrafanie has joined #ruby
eckhardt has joined #ruby
duderonomy has joined #ruby
claudiuinberlin has quit [Ping timeout: 252 seconds]
justache has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sameerynho has joined #ruby
za1b1tsu_ has joined #ruby
duderonomy has quit [Read error: Connection reset by peer]
duderonomy has joined #ruby
za1b1tsu_ has quit [Ping timeout: 252 seconds]
postmodern has joined #ruby
teej has quit [Quit: Connection closed for inactivity]
MoritaShinobu has joined #ruby
akem has quit [Ping timeout: 252 seconds]
bmurt has joined #ruby
akem has joined #ruby
suukim has quit [Quit: Konversation terminated!]
InfinityFye has quit [Quit: Leaving]
jrafanie_ has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tj_ has joined #ruby
SCHAPiE has quit [Ping timeout: 272 seconds]
jrafanie has quit [Ping timeout: 252 seconds]
code_zombie has joined #ruby
bmurt has joined #ruby
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
SCHAPiE has joined #ruby
connor_goodwolf has joined #ruby
chouhoul_ has quit [Remote host closed the connection]
chouhoulis has joined #ruby
GodFather has joined #ruby
<sgen> Where can I view the source for a ruby gem online (specifically zlib)
kurko_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<sgen> havenwood: Thanks
kurko_ has joined #ruby
mikecmpbll has joined #ruby
GodFather has quit [Ping timeout: 252 seconds]
za1b1tsu_ has joined #ruby
kurko_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
GodFather has joined #ruby
akaiiro has joined #ruby
throwntall has quit [Remote host closed the connection]
throwntall has joined #ruby
kurko_ has joined #ruby
nowhereman_ has joined #ruby
schneider has joined #ruby
sgen has quit [Ping timeout: 252 seconds]
jamesaxl has joined #ruby
tj_ has quit [Quit: Leaving]
envex has joined #ruby
hugo_dc has joined #ruby
tdy has quit [Ping timeout: 252 seconds]
hugo_dc has quit [Quit: Leaving]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
MaiconVieira has quit [Remote host closed the connection]
sgen has joined #ruby
nowhereman_ has quit [Ping timeout: 268 seconds]
teej has joined #ruby
oncall-pokemon has quit [Quit: Connection closed for inactivity]
mostlybadfly has quit [Quit: Connection closed for inactivity]
Dbugger has quit [Remote host closed the connection]
jamesaxl has quit [Quit: WeeChat 2.2]
jetchisel has quit [Ping timeout: 252 seconds]
SeepingN has joined #ruby
jetchisel has joined #ruby
<freemo_> havenwood: any idea where i could get my hands on the actual code in the defauly marshall method. im thinking of copying and modifying that so it handles our use case
bmurt has joined #ruby
alem0lars has quit [Remote host closed the connection]
<freemo_> it isnt a gem so im guessing its somewhere in the core ruby code....
schneider has quit [Quit: WeeChat 2.0.1]
<freemo_> oh damn i think its in C :(
alem0lars has joined #ruby
<freemo_> Ok how about this question: Are there any good alternatives to the default ruby marshaling. Perhaps a more feature-rich gem ?
ur5us has joined #ruby
<apeiros> depends. what do you want from serialization?
snickers has quit [Quit: Textual IRC Client: www.textualapp.com]
johnny56 has quit [Ping timeout: 272 seconds]
dellavg_ has quit [Ping timeout: 268 seconds]
<freemo_> apeiros: well mostly just something where custom serialization of classes is easy, but automatic when there is no need for custom
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<freemo_> apeiros: with the default marshal module it seems it works great when automatic, but if you have specific fields you dont want serialized then you have to write your own and can not extend from the base method (since it serializes everything). As such it makes it very hard to create customized serialization on just part of the hiararchy and keep it automatic for the rest.
<apeiros> freemo_: well, you can make any serialization easy by implementing your own serialization protocol. as in: add Object#my_serializable which returns primitive values, override that in cases where you want to customize. then do WhichEverSerializer.dump(your_obj.my_serializable)
<apeiros> s/easy/easily customizable/
<freemo_> apeiros: id have to see an example as i may not be understanding you correctly, but im not sure how that makes things any easier.
<apeiros> it frees you from depending on a specific serializer's mechanism of implementing a custom serialization.
bmurt has quit [Ping timeout: 245 seconds]
<freemo_> apeiros: then i think i may not be understanding what your suggesting
<freemo_> apeiros: the whole point is that I WANT to rely on the automatic mechanism, just selectively
<apeiros> yeah, then you'll have to read up on the docs of whichever serializer you use and follow their pattern. there are plenty of serializations:
<apeiros> json, yaml, msgpack, protobuf to name a few
<freemo_> apeiros: in short. I want to have the default serializer serialize my whole class structure (all the variables int he parent class and children class) but only customize the serialization for one local variable (in this case make sure it is just serialized to nil)
reber has quit [Remote host closed the connection]
<apeiros> ^
<freemo_> apeiros: is there one you recommend i look at first that has good support for the use case I just described? I'm not above learning the module, just need some advice as to which one might suite my needs as I described them.
<apeiros> not really. due to external circumstances I had to use json and yaml exclusively in the past.
<apeiros> well, and sometimes xml.
<freemo_> apeiros: do either of those seem to have mechanisms that would fit my needs?
<freemo_> apeiros: even if i can just rule out some in that list as not likely to be a good fit then I know where to start looking
<apeiros> I know yaml can, I don't remember how easy it was. IIRC it was rather complex there.
<freemo_> protobuf sounds cool, also it sounds like i heard of it before....
<freemo_> maybe ill look at that
<apeiros> with JSON it depends on the specific gem/framework you use. since I use json within rails, you satisfy rails' protocol for serialization.
<freemo_> ohhh protobuf.. protocol buffers.. i used this in java before!
<apeiros> I think protobuf's origin is with google/go
<freemo_> that would go beyond just serialization though (in this case for storage on the hard drive)
<freemo_> yes its google
<freemo_> but its a standard IIRC
<freemo_> so maybe msgpack...
<freemo_> man this is the first time in my expiernce with Ruby that they made something needlessly difficult that should be an everyday task
<apeiros> yes. as are all the others I mentioned ;-)
<apeiros> (standard)
<marz_d`ghostman> Is it possible to instantiate an object before each context?
za1b1tsu_ has quit [Ping timeout: 268 seconds]
<marz_d`ghostman> in rspec
<marz_d`ghostman> oh it's literally before(:context) haha
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lxsameer has joined #ruby
yokel has quit [Remote host closed the connection]
yokel has joined #ruby
nadir has quit [Quit: Connection closed for inactivity]
ta_ has joined #ruby
lxsameer has quit [Ping timeout: 250 seconds]
<baweaver> hrm hrm
xfbs has quit [Quit: afk]
Chetic has quit [Ping timeout: 246 seconds]
<marz_d`ghostman> My code is creating a file via https://gist.github.com/marzdgzmn/cda2e7bb2b781db5724676780cc9dafd However when testing it using rspec, it is giving me an error: does not respond to either `exist?` or `exists?`
<marz_d`ghostman> .to be_pressent, works though
<marz_d`ghostman> what's the difference?
jetchisel has quit [Ping timeout: 250 seconds]
MoritaShinobu has quit [Quit: Leaving]
Rapture has quit [Quit: Textual IRC Client: www.textualapp.com]
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
GodFather has quit [Ping timeout: 250 seconds]
jetchisel has joined #ruby
desperek has quit [Quit: xoxo]
bkxd has quit [Ping timeout: 276 seconds]
ldnunes has quit [Quit: Leaving]
johnny56 has joined #ruby
bmurt has joined #ruby
bmurt has quit [Ping timeout: 252 seconds]
ivanskie has joined #ruby
jetchisel has quit [Ping timeout: 268 seconds]
jetchisel has joined #ruby
kurko_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
donofrio has joined #ruby
eckhardt has joined #ruby
RougeR has joined #ruby
Sembei has joined #ruby
Dimik has joined #ruby
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ivanskie has joined #ruby
<zenspider> marz_d`ghostman: #exist? is a class method on File, not an instance... chances are you're calling it on the instance.
ta_ has quit [Remote host closed the connection]
schleppel has quit [Quit: Konversation terminated!]
ivanskie has quit [Client Quit]
<zenspider> freemo_: I really don't see what's hard about Marshal... esp if you're now reaching for protobuf. That seems absurd to me.
justicefries has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
justicefries has joined #ruby
ta_ has joined #ruby
ta__ has joined #ruby
ta_ has quit [Read error: Connection reset by peer]
jcalla has quit [Ping timeout: 244 seconds]
za1b1tsu_ has joined #ruby
MaiconVieira has joined #ruby
justicefries has quit [Quit: Textual IRC Client: www.textualapp.com]
asphyxia has quit [Ping timeout: 252 seconds]
jcalla has joined #ruby
za1b1tsu_ has quit [Ping timeout: 268 seconds]
Chetic has joined #ruby
jrafanie_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bkxd has joined #ruby
fluxAeon has quit [Quit: Textual IRC Client: www.textualapp.com]
Nicmavr has quit [Read error: Connection reset by peer]
mikecmpbll has quit [Quit: inabit. zz.]
Nicmavr has joined #ruby
code_zombie has quit [Quit: Leaving]
kurko_ has joined #ruby
pulgolino has quit [Remote host closed the connection]
phaul has quit [Quit: bye]
supergeek has joined #ruby
supergeek has quit [Client Quit]
polishdub has quit [Quit: leaving]
MaiconVieira has quit [Ping timeout: 252 seconds]
sameerynho has quit [Ping timeout: 252 seconds]
duderonomy has joined #ruby
<cthulchu> folks, how is it called again?
<cthulchu> when I use arguments like a:b in def?
<cthulchu> I think this is the bestest thing about Ruby
<cthulchu> well, to me
<cthulchu> cuz I never used it before
<SeepingN> defaults?
fluxAeon has joined #ruby
<cthulchu> no, not a=b
<cthulchu> like def error_reporting(screen_name:"", category:"", action:"", label:"")
<cthulchu> and then you can do error_reporting(category:"pew-pew")
duderonomy has quit [Ping timeout: 250 seconds]
<cthulchu> so the order and quantity doesn't matter
<cthulchu> it makes my life sooooo much easier
<cthulchu> also makes my code sloppier
<cthulchu> what is it called
<cthulchu> there was a term for it
<cthulchu> keyed arguments?
<cthulchu> I think apeiros told me about this back when I was starting it
<freemo_> zenspider: marshal is easy to understand, just not written in a way that is very easy for the user to work with.
DTZUZO has quit [Ping timeout: 252 seconds]
ivanskie has joined #ruby
DTZUZO has joined #ruby
<zenspider> freemo_: compared to protobuf?!? disagree
cd has quit [Quit: cd]
cd has joined #ruby
supergeek has joined #ruby
<freemo_> zenspider: I already ruled out protobuf and am instead looking at other gems
asphyxia has joined #ruby
<zenspider> well... I'll put my vote down for sticking with marshal. it works well. very fast. and actually quite easy when you need to customize when the default behavior doesn't work for you.
MaiconVieira has joined #ruby
<freemo_> zenspider: Well thats what we tried to do for 2 days now and couldnt get it working right, so how do you suggest I do it? Cause switching to something else was a last resort anyway for me
supergeek has quit [Quit: Goodbye cruel world...]
<zenspider> "couldn't get it working right" is too vague to work with. What'd you try and what happened instead?
yqt has joined #ruby
fluxAeon has quit [Ping timeout: 252 seconds]
yqt has quit [Ping timeout: 268 seconds]
fluxAeon_ has joined #ruby
uplime has quit [Quit: WeeChat 2.2]
clemens3 has quit [Ping timeout: 252 seconds]
clemens3 has joined #ruby
DTZUZO has quit [Ping timeout: 250 seconds]
Eiam has joined #ruby
<cthulchu> gives me this error: https://i.imgur.com/65dcrIC.png
<cthulchu> what did I do wrong?
nadir has joined #ruby
swoorup has joined #ruby
asphyxia has quit [Ping timeout: 246 seconds]
bmurt has joined #ruby
<Radar> cthulchu: why are you using triple equals
<Radar> double equals will be fine
nine_milli has joined #ruby
<nine_milli> I CHARGE EVERYONE HERE WITH DRINKING BEER DURING HIGH SKOOL
<cthulchu> no
<nine_milli> SHOW ME YO CALENDARS
<cthulchu> tripple equals are magic
<cthulchu> I want to use magic equals
<cthulchu> mostly to be able to supply a regex on the left side of it
<cthulchu> but it can do more than that
<cthulchu> anyhow, I use it only as a very convenient way to do matching regex instead of strings when I feel like it in the middle of a test
za1b1tsu_ has joined #ruby
<baweaver> !troll nine_milli
nine_milli was kicked from #ruby by ruby[bot] [trolling is a bannable offense, see http://ruby-community.com/pages/user_rules]
<baweaver> nighty night
<cthulchu> wtf
<cthulchu> ah, right
<cthulchu> thanks
<cthulchu> guys, help me with this one so I could go home!
<baweaver> cthulchu: what's the rest of the code?
<cthulchu> there's a lot
<cthulchu> you wanna see the whole function?
<cthulchu> let me upload it
<baweaver> Also not great idea to use === directly
<cthulchu> directly?
<Radar> ugh what's the URL
<Radar> cthulchu: ^ do that or ban
<Radar> only 33% kidding
<cthulchu> it would take more time
<cthulchu> also I don't run it
<cthulchu> it's a pain to run
<cthulchu> it's my rubocop swearing
za1b1tsu_ has quit [Ping timeout: 250 seconds]
gheegh has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<baweaver> eesh.
* Radar reaches for the paper bag
<cthulchu> line 20 is where I get red warnings from rubocop
<Radar> Rubocop works fine on my machine running that code.
<Radar> Except it complains a lot about that code.
<Radar> Like, quite a lot.
asphyxia has joined #ruby
<Radar> a.rb:50:138: C: Style/CaseEquality: Avoid the use of the case equality operator ===.
<baweaver> What's length_checker doing?
<baweaver> Clamping?
<Radar> Oh hey would you look at that!
snk has joined #ruby
<cthulchu> it checks the length
<cthulchu> it returns either true or an error message
<baweaver> of?
<Radar> obvious troll is obvious
<cthulchu> it checks the lengths of two arrays I give it
<baweaver> why?
<cthulchu> cuz I need it?
karapetyan has quit [Remote host closed the connection]
<cthulchu> I need to know if the number of matching events is in set boundaries
<baweaver> Y'know if you want help that's not a great way to motivate people to continue
<baweaver> There we go
<baweaver> What's the function look like?
<cthulchu> it's not very pleasant
<baweaver> cthulchu: new rule to follow: functions return one type
<baweaver> i.e. boolean or string
<baweaver> not both
<cthulchu> yeah, I kinda know that
<cthulchu> didn't want to bother
<baweaver> Do you know about default values?
<cthulchu> also it's best to have one return point and I may have a few
<cthulchu> yeah, I do, I do
<cthulchu> I know
<baweaver> Give them to min and max in mobile_tester
<cthulchu> it's an old function
<cthulchu> I can give them to this function too
<cthulchu> no matter though
<cthulchu> I'm rewriting them either way
swoorup has quit [Remote host closed the connection]
<cthulchu> haven't got to the length checker properly