elcontrastador has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ur5us has quit [Ping timeout: 265 seconds]
elcontrastador has joined #ruby
impermanence has quit [Quit: Connection closed]
tpanarch1st has quit [Ping timeout: 250 seconds]
ChmEarl has quit [Quit: Leaving]
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ur5us has joined #ruby
buckworst has quit [Quit: WeeChat 2.8]
alfiemax has quit [Ping timeout: 250 seconds]
cliluw has joined #ruby
cliluw has quit [Ping timeout: 265 seconds]
darkstardevx has quit [Ping timeout: 256 seconds]
darkstardevx has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
buckworst has joined #ruby
jinmiaoluo has quit [Ping timeout: 265 seconds]
hassox has quit [Remote host closed the connection]
buckworst has quit [Quit: WeeChat 2.8]
Esa__ has joined #ruby
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
ur5us has quit [Ping timeout: 246 seconds]
alfiemax has joined #ruby
jetchisel has joined #ruby
banisterfiend has joined #ruby
jinmiaoluo has joined #ruby
sarink has joined #ruby
jinmiaoluo has quit [Ping timeout: 265 seconds]
sauvin has joined #ruby
jinmiaoluo has joined #ruby
troulouliou_dev has joined #ruby
jinmiaoluo has quit [Ping timeout: 260 seconds]
lightstalker has quit [Ping timeout: 264 seconds]
alfiemax has quit [Remote host closed the connection]
alfiemax has joined #ruby
alfiemax has quit [Ping timeout: 240 seconds]
vdl has quit [Ping timeout: 264 seconds]
elcontrastador has quit [Ping timeout: 260 seconds]
vdl has joined #ruby
alfiemax has joined #ruby
pandakekok9 has joined #ruby
sarink has quit [Ping timeout: 240 seconds]
cd has quit [Quit: cd]
ua has quit [Ping timeout: 256 seconds]
ua has joined #ruby
alfiemax has quit [Remote host closed the connection]
jinmiaoluo has joined #ruby
alfiemax has joined #ruby
_whitelogger has joined #ruby
jinmiaoluo has quit [Ping timeout: 265 seconds]
ldepandis has joined #ruby
renich has joined #ruby
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alexherbo2 has joined #ruby
conta has joined #ruby
d3bug has quit [Quit: Connection closed for inactivity]
jinmiaoluo has joined #ruby
zacts has joined #ruby
jinmiaoluo has quit [Ping timeout: 250 seconds]
jinmiaoluo has joined #ruby
jinmiaoluo has quit [Ping timeout: 240 seconds]
jinmiaoluo has joined #ruby
conta has quit [Quit: conta]
imode has quit [Ping timeout: 256 seconds]
alexherbo21 has joined #ruby
alexherbo2 has quit [Ping timeout: 256 seconds]
alexherbo21 is now known as alexherbo2
alfiemax has quit [Ping timeout: 256 seconds]
indian_yogi has joined #ruby
buckworst has joined #ruby
gix has joined #ruby
schne1der has joined #ruby
sergioro has quit [Quit: leaving]
xco has joined #ruby
lurkless has quit [Remote host closed the connection]
darkstardevx has quit [Ping timeout: 260 seconds]
alfiemax has joined #ruby
darkstardevx has joined #ruby
lurkless has joined #ruby
alfiemax has quit [Ping timeout: 260 seconds]
alexherbo2 has quit [Quit: Ping timeout (120 seconds)]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alexherbo2 has joined #ruby
TCZ has joined #ruby
buckworst has quit [Quit: WeeChat 2.8]
alexherbo22 has joined #ruby
alexherbo2 has quit [Read error: Connection reset by peer]
jinmiaoluo has quit [Ping timeout: 246 seconds]
alexherbo2 has joined #ruby
alexherbo22 has quit [Ping timeout: 256 seconds]
jinmiaoluo has joined #ruby
darkstardevx has quit [Remote host closed the connection]
darkstardevx has joined #ruby
renich has quit [Quit: renich]
davor has quit [Ping timeout: 250 seconds]
deathwishdave has joined #ruby
alexherbo21 has joined #ruby
alexherbo2 has quit [Ping timeout: 256 seconds]
alexherbo21 is now known as alexherbo2
deathwishdave has quit [Client Quit]
davor has joined #ruby
darkstardevx has quit [Remote host closed the connection]
darkstardevx has joined #ruby
darkstardevx has quit [Remote host closed the connection]
darkstardevx has joined #ruby
giorgian has quit [Remote host closed the connection]
indian_yogi has quit [Ping timeout: 250 seconds]
hramrach has quit [Ping timeout: 250 seconds]
darkstardevx has quit [Remote host closed the connection]
darkstardevx has joined #ruby
ur5us has joined #ruby
DTZUZU has joined #ruby
DTZUZU2 has quit [Ping timeout: 264 seconds]
darkstardevx has quit [Remote host closed the connection]
darkstardevx has joined #ruby
hramrach has joined #ruby
darkstardevx has quit [Remote host closed the connection]
kristian_on_linu has joined #ruby
jinmiaoluo has quit [Quit: WeeChat 2.8]
ur5us has quit [Quit: Leaving]
troulouliou_dev has quit [Quit: Leaving]
alexherbo2 has quit [Quit: Ping timeout (120 seconds)]
alexherbo2 has joined #ruby
Ai9zO5AP has quit [Remote host closed the connection]
alexherbo28 has joined #ruby
alexherbo2 has quit [Ping timeout: 265 seconds]
alexherbo28 is now known as alexherbo2
buckworst has joined #ruby
reber has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
buckworst has quit [Quit: WeeChat 2.8]
buckworst has joined #ruby
donofrio__ has joined #ruby
buckworst has quit [Ping timeout: 256 seconds]
donofrio_ has quit [Ping timeout: 256 seconds]
TCZ has quit [Quit: Leaving]
hramrach has quit [Ping timeout: 264 seconds]
<siery>
I been trying for long time.. and still ain't get this GC stuff.. Even after dereferance objects to WealRef and calling ObjectSpace.garbage_collect, I till see thouse objects hanging in memory..
<siery>
Can someone tell me what am I doing wrong with this restart! method?
<phaul>
siery: I'm not sure if this is the problem, but be aware, that if you have a block in the same lexical context where the objects were allocated then the block will hold a reference to the object as it's part of the environment the block has to run in. Which is somewhat confusing
<phaul>
a = 'str'; foo { blah } here a cannot be freed as calling foo might use it
<siery>
phaul: hmm.. So you mean I can not fully free those objects?
<siery>
I have also tried this, with no luck:
<siery>
ObjectSpace.each_object GameObject do |object|
<phaul>
idk. I haven't looked at your code. It's something to be aware of
<siery>
object = WeakRef.new object
<siery>
end
<jhass>
well that of course wouldn't do this
<jhass>
it just reassigns the local variable object
<jhass>
does nothing for potential references to it
tpanarch1st has joined #ruby
<jhass>
mh, cannot really find any tool that would show a nice reference tree unfortunately, just general heap dump analyzers showing how many objects per type there are and maybe their allocation location
<jhass>
idk, jruby + visualvm might be worth a shot
<siery>
I don't want to clean referances.. that works fine here, but I want to completely delete those objects from the scope memory
<jhass>
how are you determining they're still there?
reber_ has joined #ruby
<jhass>
sorry, didn't read up on everytjhing
<siery>
All are inheriting from GameObject, so I can just simply print them:
<siery>
ObjectSpace.each_object GameObject do |object|
<siery>
puts "An objects found in memory: #{object}"
<siery>
end
reber has quit [Ping timeout: 250 seconds]
<siery>
And all though they are deleted from my @engine_space hash (which is meant to store the scope of @game object), they are still in memory
reber_ has quit [Remote host closed the connection]
<jhass>
maybe Gosu just keeps a reference to your Game subclass?
<siery>
You can clone this repo and run /bin/thief and then press f6, this will run the restart! method
<siery>
hmm.. maybe, I was just thinking that
pandakekok9 has quit [Quit: good night]
xco has joined #ruby
chalkmonster has joined #ruby
wymillerlinux has joined #ruby
alfiemax has joined #ruby
alfiemax has quit [Ping timeout: 250 seconds]
felix_221986 has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
wilhelm418 has joined #ruby
caterfxo has quit [Quit: leaving]
sergioro has joined #ruby
giorgian has joined #ruby
cahoots has joined #ruby
<cahoots>
hi, i want to do if 'hash["key1"] && hash["key1"]["key2"]' with some method that takes the list of keys, like 'if hash.inner_key("key1", "key2")'
<havenwood>
imode: Roda really is great. I've had an easy time porting Sinatra apps to it and have never been sorry.
<imode>
a project that requires server sent events. I can't really wrap my head around how applications are supposed to be structured with Sinatra/Roda because I'm not a fan of object orientation.
<havenwood>
imode: Whatcha using SSE for?
<havenwood>
What do the events show?
<imode>
I guess the closest description I can provide is a modernized LambdaMOO.
<havenwood>
imode: Then you might actually like Roda. It's more functional than anything.
bvdw has quit [Remote host closed the connection]
<imode>
yeah, perhaps.. I think in terms of procedures and interfaces vs. classes an inheritance.
<imode>
also not a fan of additive security vs. subtractive security.
<havenwood>
imode: If I wasn't going to use Ruby for something like that, I'd use Elixir with Phoenix rather than Go as the alternative.
<imode>
not a fan of how Elixir builds stuff.
<havenwood>
imode: What part?
<havenwood>
imode: The tooling is one of the biggest wins for me and I always had an easier time building and deploying Elixir even though I have more experience doing so with Ruby.
<imode>
last time I used it, it relied on mix to generate application templates for you. I'm a C programmer. not interested in generated projects.
<havenwood>
imode: The generators are to guide beginners on best practices.
<imode>
sure. and that's fine. I don't like them.
<havenwood>
imode: Please just don't use them. But it's not a good reason to avoid Phoenix!
<imode>
to put in clearer terms, I guess: I like small languages. larger languages intimidate me because there's a bunch of modes of failure that you don't account for on your first pass through building an application.
<havenwood>
imode: Elixir is a small language. It's lovely.
<imode>
they tend to impose structure and practices to cope with that.
<imode>
but the problems are still there.
<havenwood>
Ruby is a much larger, more complex language.
<havenwood>
Go is too austere for me.
<imode>
ruby is also pretty battle-proven. packaging and running elixir on things like heroku and AWS is also, iirc, a bit of a pain.
<havenwood>
The Ruby grammar borders on nuts. Why can't we just LISP? :P
<imode>
forth 4 lyfe.
<havenwood>
imode: Good point about subtractive security, but I think Roda is worth it. I agree on preferring to write my own code, so I know what it does and only have what I need.
<imode>
how long has Roda been around?
<imode>
the cliche of time-tested software is still a cliche, but it's my go-to.
<imode>
when you start having users, you get paranoid about what you didn't think of.
<havenwood>
imode: I've been using Roda for years. It's maintained by Jeremy Evans, who is on Ruby core and also maintains the awesome Sequel gem.
<havenwood>
imode: Jeremy Evans is the best of maintainers.
<havenwood>
imode: The code is exquisite and he dogfoods it widely in prod.
xco has joined #ruby
<havenwood>
imode: (He runs a team working for the US govt.)
<imode>
that's quite the endorsement.
<imode>
how does it compare to sinatra when it comes to application structures?
<havenwood>
imode: It tends to be more DRY and a bit flatter, due to the routing tree.
<havenwood>
imode: It composes flexibly, with multiple plugins available depending on the style you'd like.
<havenwood>
imode: Jeremy has ported a bunch of Sinatra apps to Roda and has some great examples. I've ported a few myself and never looked back. Roda is Sinatra-inspired, and has plugins that enable more Sinatra-like behavior, so porting is quick.
gix has quit [Ping timeout: 250 seconds]
cahoots has quit [Ping timeout: 240 seconds]
dinfuehr has quit [Ping timeout: 256 seconds]
<havenwood>
imode: The downside is no route introspection.
dinfuehr has joined #ruby
<havenwood>
Which I can live with.
<imode>
I guess to diagram what I have to build: this is a system that takes user-submitted code, written in a custom language with a sandbox, and executes it with parameters based off of user-submitted commands.
<imode>
you listen to objects via SEE, you send commands to objects via POST.
bvdw has joined #ruby
<imode>
so the "front" part of this that doesn't include executing said code across multiple instances needs to be hardened. guarded by rate limiting, auth, etc.
<imode>
the "rear" part of this needs to be able to communicate with other instances. a single command could be spread across multiple server instances by virtue of one user's code calling another user's code.
<imode>
or, objects talking to objects.
bvdw has quit [Remote host closed the connection]
renich has joined #ruby
TCZ has joined #ruby
giorgian has joined #ruby
DTZUZU2 is now known as DTZUZU
felix_221986 has quit [Quit: Connection closed]
evdubs has quit [Quit: Leaving]
evdubs has joined #ruby
renich has quit [Quit: renich]
Emmanuel_Chanel has joined #ruby
chalkmonster has joined #ruby
hramrach has quit [Ping timeout: 260 seconds]
Xiti has quit [Ping timeout: 256 seconds]
ellcs has quit [Ping timeout: 240 seconds]
hramrach has joined #ruby
jeromelanteri has quit [Quit: Leaving]
gitter1234 has quit [Quit: Connection closed for inactivity]
roadie has quit [Remote host closed the connection]
roadie has joined #ruby
SeepingN has quit [Disconnected by services]
SeepingN_ has joined #ruby
cliluw has quit [Ping timeout: 256 seconds]
cliluw has joined #ruby
roadie has quit [Ping timeout: 256 seconds]
chalkmonster has quit [Quit: WeeChat 2.8]
leitz has joined #ruby
gix has joined #ruby
<leitz>
I'm back to my learning about patterns. Would it be a command pattern that would take a task "Buy cargo for the ship", and coordinate the messages to all the other objects touched by the action?
postmodern has joined #ruby
<jhass>
if it's for you and all the collaborators on your code, sure why not :)
<jhass>
patterns are for humans, not for computers
<jhass>
they assign words to common concepts so you can talk about them
SuperLag has quit [Remote host closed the connection]
d3bug has quit [Quit: Connection closed for inactivity]
bvdw has joined #ruby
bvdw has quit [Remote host closed the connection]
SeepingN_ has quit [Ping timeout: 272 seconds]
roadie has joined #ruby
alexherbo2 has quit [Ping timeout: 256 seconds]
zapata has joined #ruby
roadie has quit [Ping timeout: 256 seconds]
<leitz>
jhass, there's a financial incentive for me to get the language correct. Hence my question. :)
tty1 has joined #ruby
<tty1>
so im stuck on something that is probably a really stupid noob thing.... I have a module I wrote, it isnt complex it has two simple methods in it... from another class in another module i am calling the method but i get a message that claims the method is "undefined".. to double check directly on the line before the error is invoked i did a pp on the module's instance_methods and the method is being
<tty1>
listed.. so not sure why its showing as undefined
greypack has quit [Quit: All your IRC are belong to ZNC]
<tty1>
is an instance method different from a regular method maybe and im just misunderstanding something
<leitz>
tty1, there's a module_method, or something, that you need to add. I'm digging through my code, I've had the same issue. :)
<jhass>
tty1: def foo inside a module does indeed define an instance methods. These become available on a class once the module is included into it. module Foo; def x; end; end; class Bar; include Foo; end; Bar.new.x
<jhass>
if you want the method to be called like Foo.x, you need to define it as def self.x
<jhass>
if you want both to be possible, you need to use module_function as mentioned
<zenspider>
(or def Foo.x, but that's not recommended)
SuperLag has joined #ruby
<tty1>
jhass: including the module seems like a simple fix.. but what if i just want to call a single method from the module.. would there be some way to either include a single method or just to call the method without including it? or is there a way to define the method without it being an instance method?
<tty1>
ahh so def Foo.x then i guess
<tty1>
why isnt it recommended?
<jhass>
you seem to have overlooked a big part of my message :)
<leitz>
tty1, because it locks you into the Foo class, and you can't use a subclass.
zenspider has quit [Quit: bye]
<jhass>
so no, there's no reasonable way to include a single method
<leitz>
tty1, and yes, re-read jhass' note.
<jhass>
def self.x; is recommended over def Foo.x; because it doesn't repeat the module name, so it's less likely to break in case of renames :)
<tty1>
ohhh so wait i just define it as self.x then not foo.x... ok that i can do
<tty1>
i actually went with the include isntead of the static call
<leitz>
Ruby modules are pretty easy going about being included as a mixin, or just used. Of course, that gives more to learn. :)
<tty1>
leitz: im just pondering how i wrote this much code and didnt realize it before now.. allt his was working before a refactor but the weird thing is the refactor i did shouldnt have effected anything like this as far as I know.. very odd
d3bug has joined #ruby
roadie has joined #ruby
caterfxo has quit [Ping timeout: 256 seconds]
caterfxo has joined #ruby
greypack has quit [Ping timeout: 256 seconds]
madduck has joined #ruby
<madduck>
How would I go about text wrapping in Ruby? I have text, an indent width, and a possible list leader, e.g. "this is my text" wrapped to 8 chars with 1 indent and * list bullet would become: " * this\n is my\n text"
<leitz>
tty1, one time I refactored according to some advice here. Took me two weeks to get things working again. I learned a good bit, though.
<tty1>
leitz: well I know there will be a **lot** I need to fix from this refactor, I just wasnt expecting this to be one of them... The refactor was so major i couldnt do it by hand. I wrote a seperate ruby script that did all the refactoring for me.. so there will be a lot of damage left behind im sure. but still easier than doing the refactor by hand
<leitz>
tty1, nice! I tend to refactor by hand, but most of my stuff is pretty small. Since I'm learning, each refactor lets me integrate what I've learned since I last looked at the code.
buckworst has quit [Client Quit]
alfiemax has joined #ruby
<tty1>
leitz: I almost always refactor by hand.. i started doing this refactor by hand but it took several days and I barely put a dent in it and it caused me to shelf the whole project out of lack of motivation... so doing it this way was a first for me and only relevant due to the scope of the refactoring.
<leitz>
tty1, hey, whatever solves the problem at hand!