Skip to content

Instantly share code, notes, and snippets.

Writing code that generates business value

Fernando Hamasaki de Amorim prodis

Writing code that generates business value
View GitHub Profile
prodis / blocks_procs_lambdas.txt
Last active Aug 29, 2015
Fernando's whiteboard
View blocks_procs_lambdas.txt
Difference between blocks, procs and lambdas.
Blocks are not objects and can't be manipulates as objects. With procs and lambdas is possible to
create objects that represents a block.
Procs and lambdas have the 'call' method, that executes the block code associated in their creation.
A proc behaves like a block, different of lambdas that behaves like a method. For that reason,
lambdas need to receive the exact number of parameters defined in your declaration.
prodis / init_attributes.rb
Last active Oct 25, 2017
Module to initialize required attributes
View init_attributes.rb
module InitAttributes
def self.included(base)
base.send(:include, InstanceMethods)
module InstanceMethods
def initialize(attributes)
init_instance_variables(self.class.accessor_attributes, attributes)
init_instance_variables(self.class.reader_attributes, attributes)
View gist:2bde80805ec17a46b13eac44d9e4ccfb
### Keybase proof
I hereby claim:
* I am prodis on github.
* I am prodis ( on keybase.
* I have a public key ASBYWVy_Ip4Ln4bB3NQeUXJeiZScRB3HwNvoJh-_bbiT3Ao
To claim this, I am signing this object: