Created
October 19, 2012 17:58
-
-
Save JakeAustwick/3919643 to your computer and use it in GitHub Desktop.
This file contains 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
(function() { | |
var __opal = Opal, self = __opal.top, __scope = __opal, nil = __opal.nil, __breaker = __opal.breaker, __slice = __opal.slice, __klass = __opal.klass; | |
var jake = nil; | |
(function(__base, __super){ | |
// line 1, (file), class Person | |
function Person() {}; | |
Person = __klass(__base, __super, "Person", Person); | |
var Person_prototype = Person.prototype, __scope = Person._scope; | |
Person_prototype.$name = function() { | |
if (this.name == null) this.name = nil; | |
return this.name | |
}, | |
Person_prototype['$name='] = function(val) { | |
return this.name = val | |
}, nil; | |
Person_prototype.$age = function() { | |
if (this.age == null) this.age = nil; | |
return this.age | |
}, | |
Person_prototype['$age='] = function(val) { | |
return this.age = val | |
}, nil; | |
return Person_prototype.$home = function() { | |
if (this.home == null) this.home = nil; | |
return this.home | |
}, | |
Person_prototype['$home='] = function(val) { | |
return this.home = val | |
}, nil; | |
})(self, null); | |
jake = __scope.Person.$new(); | |
jake['$name=']("Jake"); | |
jake['$age='](18); | |
jake['$home=']("UK"); | |
self.$puts(jake.$name()); | |
return self.$puts(jake.$age()); | |
})(); |
This file contains 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 Person | |
attr_accessor :name | |
attr_accessor :age | |
attr_accessor :home | |
end | |
jake = Person.new | |
jake.name = "Jake" | |
jake.age = 18 | |
jake.home = "UK" | |
puts jake.name | |
puts jake.age | |
# => Jake | |
# = > 18 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment