You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've actually wanted to use a pattern like this in Ruby, where I've wanted an object to do some nonstandard behavior and then do some standard behavior. For example, an OpCode class that executes a certain operation argument then changes the value of the address in memory for a simple emulator, or a Spell class that checks if the Character casting it has enough magic_points to cast the spell, fails if it doesn't, subtracts mp_cost argument from the character casting it and executes the spell_formula argument.
The thing is, in Ruby I didn't create a special operation or spell_formula class to pass around a method / command as an argument. I used a lambda.
It would be nice if the description of this pattern was expanded to include the pros and cons of this method, since from my perspective it just seems like the natural and dare-I-say-it, ruby way to do things.
The text was updated successfully, but these errors were encountered:
I've actually wanted to use a pattern like this in Ruby, where I've wanted an object to do some nonstandard behavior and then do some standard behavior. For example, an OpCode class that executes a certain operation argument then changes the value of the address in memory for a simple emulator, or a Spell class that checks if the Character casting it has enough magic_points to cast the spell, fails if it doesn't, subtracts mp_cost argument from the character casting it and executes the spell_formula argument.
The thing is, in Ruby I didn't create a special operation or spell_formula class to pass around a method / command as an argument. I used a lambda.
It would be nice if the description of this pattern was expanded to include the pros and cons of this method, since from my perspective it just seems like the natural and dare-I-say-it, ruby way to do things.
The text was updated successfully, but these errors were encountered: