Class: Textpow::SyntaxProxy
- Inherits:
-
Object
- Object
- Textpow::SyntaxProxy
- Defined in:
- lib/ver/vendor/textpow.rb
Instance Method Summary collapse
-
#initialize(proxy, syntax) ⇒ SyntaxProxy
constructor
A new instance of SyntaxProxy.
- #method_missing(method, *args, &block) ⇒ Object
- #proxy ⇒ Object
Constructor Details
#initialize(proxy, syntax) ⇒ SyntaxProxy
Returns a new instance of SyntaxProxy.
59 60 61 62 |
# File 'lib/ver/vendor/textpow.rb', line 59 def initialize proxy, syntax @proxy, @syntax = proxy, syntax @proxy_value = nil end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/ver/vendor/textpow.rb', line 64 def method_missing(method, *args, &block) if @proxy @proxy_value ||= proxy if @proxy_value @proxy_value.send(method, *args, &block) else # warn "Failed proxying #{@proxy}.#{method}(#{args.join(', ')})" end else super end end |
Instance Method Details
#proxy ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/ver/vendor/textpow.rb', line 78 def proxy case @proxy when /^#(?<proxy>.+)/ return unless @syntax.repository @syntax.repository[$~[:proxy]] when "$self", "$base" @syntax else @syntax.syntaxes[@proxy] end end |