Skip to content

tbtlr/def.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

Simple Ruby-style inheritance for JavaScript

Example

def ("Person") ({
	init: function(name){
		this.name = name;
	},
	
	speak: function(text){
		alert(text || "Hi, my name is " + this.name);
	}
});

def ("Ninja") << Person ({
	init: function(name){
		this._super();
	},
	
	kick: function(){
		this.speak("I kick u!");
	}
});

var ninjy = new Ninja("JDD");

ninjy.speak();
ninjy.kick();

About

Simple Ruby-style inheritance for JavaScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published