Skip to content

Instantly share code, notes, and snippets.

View daxhuiberts's full-sized avatar

Dax Huiberts daxhuiberts

View GitHub Profile
@daxhuiberts
daxhuiberts / gist:822358
Created February 11, 2011 13:49 — forked from roy/gist:822341
class Object
def tap(method=nil, *params, &block)
raise ArgumentError, "supply either a block or a method name to send" if (method || block) && !(method && block)
block ||= proc { self.send method, *params }
super(&block)
end
end
@daxhuiberts
daxhuiberts / gist:822385
Created February 11, 2011 14:04 — forked from roy/gist:822341
class Object
def tap(method =nil, *params, &block)
block.call(self) if block
self.send(method, *params) if method
self
end
end
module ProcessAsset
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def process_asset(asset_name)
define_method :process do
send "#{asset_name}_file_name"
end