Skip to content

Instantly share code, notes, and snippets.

@ryaan-anthony
Last active April 19, 2016 14:25
Show Gist options
  • Save ryaan-anthony/87a336a156eb4c93c318ccad0f4cedf6 to your computer and use it in GitHub Desktop.
Save ryaan-anthony/87a336a156eb4c93c318ccad0f4cedf6 to your computer and use it in GitHub Desktop.
class BaseObject
def initialize(params = {})
params.each { |key,value| instance_variable_set("@#{key}", value) }
end
end
class ModelObject < BaseObject
def say
@model
end
end
object = ModelObject.new(:model => 'foo')
puts object.say
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment