Class: Compendium::Presenters::Base
- Inherits:
-
Object
- Object
- Compendium::Presenters::Base
show all
- Defined in:
- app/classes/compendium/presenters/base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(template, object) ⇒ Base
Returns a new instance of Base.
3
4
5
6
|
# File 'app/classes/compendium/presenters/base.rb', line 3
def initialize(template, object)
@object = object
@template = template
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object
20
21
22
23
|
# File 'app/classes/compendium/presenters/base.rb', line 20
def method_missing(*args, &block)
return @template.send(*args, &block) if @template.respond_to?(args.first)
super
end
|
Class Method Details
.presents(name) ⇒ Object
14
15
16
17
18
|
# File 'app/classes/compendium/presenters/base.rb', line 14
def self.presents(name)
define_method(name) do
@object
end
end
|
Instance Method Details
#to_s ⇒ Object
8
9
10
|
# File 'app/classes/compendium/presenters/base.rb', line 8
def to_s
"#<#{self.class.name}:0x00#{'%x' % (object_id << 1)}>"
end
|