Class: Adhearsion::DialPlan::Loader::ContextNameCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/adhearsion/voip/dial_plan.rb

Overview

< ::BlankSlate

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeContextNameCollector

Returns a new instance of ContextNameCollector.



224
225
226
# File 'lib/adhearsion/voip/dial_plan.rb', line 224

def initialize
  @contexts = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



228
229
230
231
# File 'lib/adhearsion/voip/dial_plan.rb', line 228

def method_missing(name, *args, &block)
  super if !block_given? || args.any?
  contexts[name] = DialplanContextProc.new(name, &block)
end

Instance Attribute Details

#contextsObject (readonly)

Returns the value of attribute contexts.



223
224
225
# File 'lib/adhearsion/voip/dial_plan.rb', line 223

def contexts
  @contexts
end

Class Method Details

.const_missing(name) ⇒ Object



215
216
217
218
219
# File 'lib/adhearsion/voip/dial_plan.rb', line 215

def const_missing(name)
  super
rescue ArgumentError
  raise NameError, %(undefined constant "#{name}")
end