In javascript, you can create blank objects that are not an instance of anything. Like so:
foo = {
bar: 12,
fooFunc: function() {
return this.bar;
}
}
Is this(or something similar) possible in ruby?
Ruby has an Object class from which all other objects inherit. From the Ruby docs:
Object is the parent class of all classes in Ruby. Its methods are therefore available to all objects unless explicitly overridden.
Object mixes in the Kernel module, making the built-in kernel functions globally accessible.
In Ruby 1.9:
Object.new.class #=> Object
Object.class #=> Class
Object.superclass #=> BasicObject
BasicObject.class #=> Class
BasicObject.superclass #=> nil
Objectand that would be the same.