Class: Qs::Route

Inherits:
Object
  • Object
show all
Defined in:
lib/qs/route.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(route_id, handler_class_name) ⇒ Route

Returns a new instance of Route.



9
10
11
12
13
# File 'lib/qs/route.rb', line 9

def initialize(route_id, handler_class_name)
  @id = route_id.to_s
  @handler_class_name = handler_class_name
  @handler_class = nil
end

Instance Attribute Details

#handler_classObject (readonly)

Returns the value of attribute handler_class.



7
8
9
# File 'lib/qs/route.rb', line 7

def handler_class
  @handler_class
end

#handler_class_nameObject (readonly)

Returns the value of attribute handler_class_name.



7
8
9
# File 'lib/qs/route.rb', line 7

def handler_class_name
  @handler_class_name
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/qs/route.rb', line 7

def id
  @id
end

Instance Method Details

#run(message, daemon_data) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/qs/route.rb', line 19

def run(message, daemon_data)
  QsRunner.new(self.handler_class, {
    :message => message,
    :params  => message.params,
    :logger  => daemon_data.logger
  }).run
end

#validate!Object



15
16
17
# File 'lib/qs/route.rb', line 15

def validate!
  @handler_class = constantize_handler_class(@handler_class_name)
end