Class: Textpow::SyntaxProxy
- Inherits:
-
Object
- Object
- Textpow::SyntaxProxy
- Defined in:
- lib/textpow/syntax.rb
Overview
at load time we do not know all patterns / all syntaxes so we store a proxy, that tries to find the correct syntax at runtime
Instance Method Summary collapse
-
#initialize(included_name, syntax) ⇒ SyntaxProxy
constructor
A new instance of SyntaxProxy.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(included_name, syntax) ⇒ SyntaxProxy
Returns a new instance of SyntaxProxy.
10 11 12 13 |
# File 'lib/textpow/syntax.rb', line 10 def initialize(included_name, syntax) @syntax = syntax @included_name = included_name end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/textpow/syntax.rb', line 15 def method_missing method, *args, &block if @proxy ||= proxy @proxy.send(method, *args, &block) else STDERR.puts "Failed proxying #{@proxy_name}.#{method}(#{args.join(', ')})" if $DEBUG end end |