Created
September 18, 2012 19:22
-
-
Save seanlilmateus/3745223 to your computer and use it in GitHub Desktop.
hash AR style for rubymotion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User | |
attr_accessor :id, :name, :email | |
def initialize(dictionary = {}) | |
setValuesForKeysWithDictionary(dictionary) if dictionary.is_a?(Hash) | |
end | |
def setValue(value, forUndefinedKey:key); end | |
end | |
le_user_1 = User.new(name:"Mateus", id: 10, email:"[email protected]") | |
le_user_2 = User.new(name:"Mateus", id: 10 ) | |
le_user_3 = User.new( id: 10 ) | |
le_user_5 = User.new(age: 119) | |
le_user_6 = User.new(10) | |
le_user_4 = User.new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment