Class: FCS::StringRequest

Inherits:
Request
  • Object
show all
Defined in:
lib/fcs/string_request.rb

Constant Summary

Constants inherited from Request

Request::VALID_COMMANDS, Request::VALID_HASH_COMMANDS, Request::VALID_STRING_COMMANDS

Instance Method Summary collapse

Methods inherited from Request

#dispatch!, #dispatch_raw!, #method_missing

Constructor Details

#initialize(socket) ⇒ StringRequest

Returns a new instance of StringRequest.



5
6
7
8
# File 'lib/fcs/string_request.rb', line 5

def initialize(socket)
  super(socket)
  @commands = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class FCS::Request

Instance Method Details

#generate_commandObject



10
11
12
# File 'lib/fcs/string_request.rb', line 10

def generate_command
  @commands.join(' ')
end

#update_command(method, *args, &block) ⇒ Object



14
15
16
17
# File 'lib/fcs/string_request.rb', line 14

def update_command(method, *args, &block)
  @commands << method.to_s
  @commands = @commands + args.map(&:to_s)
end