| Class | RADP |
| In: |
lib/radp.rb
|
| Parent: | Object |
| p | -> | priority |
| p | [RW] | The current priority |
io can be anything that accepts <<
# File lib/radp.rb, line 8 def initialize(io=$stdout,&block) @io = io @io << "; Generated by radp (http://hans.fugal.net/src/radp)\n" @state = :top yield(self) if block_given? end
An Asterisk application (e.g. Dial(‘ZAP/1’,20))
# File lib/radp.rb, line 48 def app(name,*args) raise "Can't have an application here" unless @state == :ext p = @p.to_i @io << "exten => #{@extension},#{p},#{name}(#{args.join ','})\n" @p += 1 return p end
Asterisk include directive
# File lib/radp.rb, line 36 def includes(name) raise "Can't have an includes here" unless @state == :context @io << "include => #{name}\n" end
For creating applications
# File lib/radp.rb, line 57 def method_missing(name,*args,&block) if @state == :ext app(name,args) else super end end