<Lite>
My plugins dump everything to rbot's registry hash, so it would be less rewriting that way I think.
<Lite>
thanks
<Lite>
I'll look into this
<Lite>
Also, is there a centralized location where people contribute plugins or snippets? I'm sure a lot of my plugins aside from the game already exist in one form or another.
<dominikh>
cool. if there's more, you know where we are
txdv has joined #cinch
<Lite>
not sure why you are on irc anwering questions on Christmas, but thanks
<txdv>
dominikh: can you give me a pointer on how you create a inclass method like match which somehow gets a reference to the next defined method?
<Lite>
and if anybody wants any snippets for card games for cinch I've made tons that I can port
<dominikh>
Lite: in Germany, the major part of christmas with family and gifts etc happens on the 24th
<Lite>
ah, yeah
<Lite>
didn't think about that
<dominikh>
(also I really don't care much for Christmas ;))
<dominikh>
txdv: that'd be a decorator; but Cinch's match has no idea about the next method you define. match either defaults to a method called execute, or expects you to give it the method name.
<dominikh>
txdv: anyway, google for ruby + decorator pattern. even though in ruby 2.1 there's a new way to implement them
<txdv>
thanks
<txdv>
if I match against /func .../ it will invoke the method func in the plugin?
<dominikh>
what? no.
<dominikh>
look at the examples.
<txdv>
o yeah, i'm blind, i provide the method name
<txdv>
and I thought I just can get the next defined method name somehow magically
<dominikh>
there are ways; none of which Cinch will ever make use of :)
<dominikh>
that there is a years old library of mine that uses the decorator pattern.
<dominikh>
you simply overwrite the method_added/singleton_method_added methods
<txdv>
thanks ill look into it
postmodern has quit [Quit: Leaving]
somasonic_ has joined #cinch
somasonic has quit [*.net *.split]
literal has quit [*.net *.split]
somasonic_ is now known as somasonic
postmodern has joined #cinch
mlipienski has joined #cinch
<mlipienski>
hi, I'm new to cinch. I have two plugins that share some data, I'm making that data available to each other thru a class variable. I'm wondering whether this is the right way to do it, is there a better way or I'm doing something really messy?!
<dominikh>
well, class variables are wrong as soon as you want to run multiple instances of the plugin in a single ruby process (e.g. when running multiple bots)
<dominikh>
you can use instance variables and use the plugin_list to find the concrete instance, you can use the `shared` helper (which is a bot-global shared hash), you can use an event driven way of exchanging data if that makes sense for your use case, and there are probably other ways as well
<dominikh>
depends on what you're actually sharing the data for
<mlipienski>
oh so many options, I guess I should dive into the documentation. thanks for your help dominikh
<dominikh>
fwiw, `shared` isn't documented. it's not officially part of Cinch because I haven't decided whether to keep it yet or not
mlipienski has quit [Quit: Leaving]
Azure has quit [Quit: My MBP went to sleep.]
somasonic has quit [Ping timeout: 272 seconds]
somasonic has joined #cinch
Spami has joined #cinch
Spami has quit [Quit: This computer has gone to sleep]
ayonix has quit [Read error: Operation timed out]
ayonix has joined #cinch
<txdv>
metaprogramming is brainfuck
<txdv>
dominikh: your keywords_arguments does more than decorate a method
<txdv>
it intercepts all the calls
<txdv>
which is a nice
literal has joined #cinch
<dominikh>
that's the point of the decoration. it's a wrapper, a poor man's advice
postmodern has quit [Quit: Leaving]
<txdv>
I wanted to do something different! Call a decorator on intatiation of a class with the class instance and method information
<txdv>
the interception could be a nice feature too
<dominikh>
... on instantiation? that's what the initialize method is for
somasonic has quit [Ping timeout: 272 seconds]
somasonic has joined #cinch
<cout>
txdv: I didn't realize brainfuck had metaprogramming support
ayonix has quit [Quit: No Ping reply in 180 seconds.]
ayonix has joined #cinch
ayonix has quit [Quit: No Ping reply in 180 seconds.]
ayonix has joined #cinch
Azure has joined #cinch
Azure has quit [Ping timeout: 245 seconds]
ayonix has quit [Quit: No Ping reply in 180 seconds.]