Class: ProcessSip::Subcommand

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/process_sip.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missingObject



82
# File 'lib/process_sip.rb', line 82

def call(...) = adapter.call(name, ...)

Instance Method Details

#callObject Also known as: method_missing, read



81
# File 'lib/process_sip.rb', line 81

def call(...) = adapter.call(name, ...)

#eachObject Also known as: each_line



67
# File 'lib/process_sip.rb', line 67

def each(&) = stream(&)

#match?Boolean

Returns:

  • (Boolean)


70
# File 'lib/process_sip.rb', line 70

def match?(...) = call.match?(...)

#readlines(chomp: true) ⇒ Object



71
# File 'lib/process_sip.rb', line 71

def readlines(chomp: true) = call { _1.readlines(chomp:) }

#streamObject



73
74
75
76
77
78
79
# File 'lib/process_sip.rb', line 73

def stream(*, **)
  return enum_for(:stream, *, **) unless block_given?

  call(*, **) do |io|
    while line = io.gets&.chomp; yield line; end
  end
end