Class: BBK::App::Dispatcher::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/bbk/app/dispatcher/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(route, message) ⇒ Result

Returns a new instance of Result.



8
9
10
11
12
13
14
# File 'lib/bbk/app/dispatcher/result.rb', line 8

def initialize(route, message)
  @route = route.is_a?(String) ? Dispatcher::Route.new(route) : route

  raise 'route must be of type Dispatcher::Route' unless @route.is_a?(Dispatcher::Route)

  @message = message
end

Instance Attribute Details

#messageObject

Returns the value of attribute message.



6
7
8
# File 'lib/bbk/app/dispatcher/result.rb', line 6

def message
  @message
end

#routeObject

Returns the value of attribute route.



6
7
8
# File 'lib/bbk/app/dispatcher/result.rb', line 6

def route
  @route
end

Instance Method Details

#deconstructObject



16
17
18
# File 'lib/bbk/app/dispatcher/result.rb', line 16

def deconstruct
  [route.to_s, message]
end

#deconstruct_keys(_keys) ⇒ Object



20
21
22
# File 'lib/bbk/app/dispatcher/result.rb', line 20

def deconstruct_keys(_keys)
  {route: route.to_s, message: message}
end