Class: Prototypal::Object
- Inherits:
-
Object
- Object
- Prototypal::Object
show all
- Defined in:
- lib/prototypal/object.rb
Instance Method Summary
collapse
Constructor Details
#initialize(prototype = nil) ⇒ Object
5
6
7
|
# File 'lib/prototypal/object.rb', line 5
def initialize(prototype = nil)
@prototype = prototype
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
13
14
15
16
|
# File 'lib/prototypal/object.rb', line 13
def method_missing(name, *args, &block)
return @prototype.send(name, *args, &block) if respond_to_missing?(name)
super
end
|
Instance Method Details
18
19
20
|
# File 'lib/prototypal/object.rb', line 18
def inspect
"#<Prototypal::Object @prototype=#{@prototype.inspect}>"
end
|
#respond_to_missing?(name, include_private = false) ⇒ Boolean
9
10
11
|
# File 'lib/prototypal/object.rb', line 9
def respond_to_missing?(name, include_private = false)
@prototype.respond_to?(name) || super
end
|