Class: Remarkably::Base::Engine
- Inherits:
-
Object
- Object
- Remarkably::Base::Engine
show all
- Defined in:
- lib/remarkably.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(*args, &block) ⇒ Engine
Returns a new instance of Engine.
17
18
19
20
21
|
# File 'lib/remarkably.rb', line 17
def initialize *args, &block
clear!
@remarkably_engine = self
self.instance_eval( &block ) if block_given?
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
35
36
37
|
# File 'lib/remarkably.rb', line 35
def method_missing(sym, *args, &block)
missing_method( sym, self, *args, &block )
end
|
Instance Attribute Details
Returns the value of attribute remarkably_engine.
15
16
17
|
# File 'lib/remarkably.rb', line 15
def
@remarkably_engine
end
|
Instance Method Details
#clear! ⇒ Object
39
40
41
|
# File 'lib/remarkably.rb', line 39
def clear!
@output = ''
end
|
#method!(sym, args, hash, &block) ⇒ Object
43
44
|
# File 'lib/remarkably.rb', line 43
def method! sym, args, hash, &block
end
|
#missing_method(sym, context, *args, &block) ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/remarkably.rb', line 23
def missing_method(sym, context, *args, &block)
@context = context
hash = args.last.is_a?(Hash) ? args.pop : {}
responder ||= context. if context..respond_to?( sym )
responder ||= self if self.respond_to?( sym )
if responder
responder.send( sym, args, hash, &block )
else
method!(sym, args, hash, &block)
end
end
|
#to_s ⇒ Object
46
47
48
49
50
|
# File 'lib/remarkably.rb', line 46
def to_s
result = @output
clear!
result
end
|