Class: Net::NNTPRequest

Inherits:
NNTPGenericRequest show all
Defined in:
lib/net/nntp/request.rb

Constant Summary

Constants inherited from NNTPGenericRequest

Net::NNTPGenericRequest::RESPONSES

Instance Attribute Summary

Attributes inherited from NNTPGenericRequest

#raw

Instance Method Summary collapse

Methods inherited from NNTPGenericRequest

#response_class

Constructor Details

#initialize(*params) ⇒ NNTPRequest

Returns a new instance of NNTPRequest


35
36
37
38
39
40
# File 'lib/net/nntp/request.rb', line 35

def initialize(*params)
  raw = self.class::METHOD.dup
  processed_params = process_parameters(params)
  raw << " #{processed_params}" unless processed_params.empty?
  super(raw)
end

Instance Method Details

#process_parameters(params) ⇒ Object


42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/net/nntp/request.rb', line 42

def process_parameters(params)
  processed = []
  params.each do |param|
    next if param.nil?

    processed << case
                 when param.is_a?(Range)
                   process_range(param)
                 else
                   param.to_s
                 end
  end

  processed.join(' ')
end