Class: Punchblock::Translator::Asterisk::Channel

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/punchblock/translator/asterisk/channel.rb

Constant Summary collapse

NORMALIZATION_REGEXP =
/^(?<prefix>Bridge\/)*(?<name>[^<>]*)(?<suffix><.*>)*$/.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.new(other) ⇒ Object



9
10
11
# File 'lib/punchblock/translator/asterisk/channel.rb', line 9

def self.new(other)
  other.is_a?(self) ? other : super
end

Instance Method Details

#bridged?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/punchblock/translator/asterisk/channel.rb', line 25

def bridged?
  @bridged ||= (prefix || suffix)
end

#nameObject



13
14
15
# File 'lib/punchblock/translator/asterisk/channel.rb', line 13

def name
  matchdata[:name]
end

#prefixObject



17
18
19
# File 'lib/punchblock/translator/asterisk/channel.rb', line 17

def prefix
  matchdata[:prefix]
end

#suffixObject



21
22
23
# File 'lib/punchblock/translator/asterisk/channel.rb', line 21

def suffix
  matchdata[:suffix]
end

#to_sObject



29
30
31
# File 'lib/punchblock/translator/asterisk/channel.rb', line 29

def to_s
  __getobj__
end