Skip to content

Instantly share code, notes, and snippets.

@daxhuiberts
Forked from roy/process_asset.rb
Created March 18, 2011 13:20
Show Gist options
  • Save daxhuiberts/876053 to your computer and use it in GitHub Desktop.
Save daxhuiberts/876053 to your computer and use it in GitHub Desktop.
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
end
end
end
class Person
include ProcessAsset
process_asset :photo
def photo_file_name
"testing.jpg"
end
end
p = Person.new
puts p.process #=> testing.jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment