Class: Adhearsion::PathString

Inherits:
String show all
Defined in:
lib/adhearsion/initializer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from String

===

Constructor Details

#initialize(path) ⇒ PathString

Returns a new instance of PathString.



6
7
8
9
# File 'lib/adhearsion/initializer.rb', line 6

def initialize(path)
  super
  defaults
end

Instance Attribute Details

#component_pathObject

Returns the value of attribute component_path.



4
5
6
# File 'lib/adhearsion/initializer.rb', line 4

def component_path
  @component_path
end

#dialplan_pathObject

Returns the value of attribute dialplan_path.



4
5
6
# File 'lib/adhearsion/initializer.rb', line 4

def dialplan_path
  @dialplan_path
end

#log_pathObject

Returns the value of attribute log_path.



4
5
6
# File 'lib/adhearsion/initializer.rb', line 4

def log_path
  @log_path
end

Instance Method Details

#base_path=(value) ⇒ Object



17
18
19
20
# File 'lib/adhearsion/initializer.rb', line 17

def base_path=(value)
  replace(value)
  defaults
end

#defaultsObject



11
12
13
14
15
# File 'lib/adhearsion/initializer.rb', line 11

def defaults
  @component_path = build_path_for "components"
  @dialplan_path  = dup
  @log_path       = build_path_for "logs"
end

#dial_plan_named(name) ⇒ Object



30
31
32
# File 'lib/adhearsion/initializer.rb', line 30

def dial_plan_named(name)
  File.join(dialplan_path, name)
end

#using_base_path(temporary_base_path, &block) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/adhearsion/initializer.rb', line 22

def using_base_path(temporary_base_path, &block)
  original_path = dup
  self.base_path = temporary_base_path
  block.call
ensure
  self.base_path = original_path
end