Class: RiderServer::Request
Instance Method Summary collapse
- #[](name) ⇒ Object
- #[]=(name, value) ⇒ Object
- #fetch(*args) ⇒ Object
- #id ⇒ Object
-
#initialize(operation) ⇒ Request
constructor
A new instance of Request.
- #inspect ⇒ Object
- #key?(name) ⇒ Boolean
- #op ⇒ Object
- #session ⇒ Object
- #set(key, value) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(operation) ⇒ Request
Returns a new instance of Request.
14 15 16 17 18 19 |
# File 'lib/rider_server/request.rb', line 14 def initialize(operation) raise "Operation ID cannot be nil" if operation["id"].nil? raise "Operation name cannot be nil" if operation["op"].nil? @data = operation end |
Instance Method Details
#[](name) ⇒ Object
45 46 47 |
# File 'lib/rider_server/request.rb', line 45 def [](name) @data[name] end |
#[]=(name, value) ⇒ Object
49 50 51 |
# File 'lib/rider_server/request.rb', line 49 def []=(name, value) @data[name] = value end |
#fetch(*args) ⇒ Object
37 38 39 |
# File 'lib/rider_server/request.rb', line 37 def fetch(*args) @data.fetch(*args) end |
#id ⇒ Object
25 26 27 |
# File 'lib/rider_server/request.rb', line 25 def id @data["id"] end |
#inspect ⇒ Object
53 54 55 |
# File 'lib/rider_server/request.rb', line 53 def inspect "#<RiderServer::Request:#{object_id} id=#{id} session=#{session} op=#{op}}>" end |
#key?(name) ⇒ Boolean
41 42 43 |
# File 'lib/rider_server/request.rb', line 41 def key?(name) @data.key? name end |
#op ⇒ Object
21 22 23 |
# File 'lib/rider_server/request.rb', line 21 def op @data["op"] end |
#session ⇒ Object
29 30 31 |
# File 'lib/rider_server/request.rb', line 29 def session @data["session"] end |
#set(key, value) ⇒ Object
33 34 35 |
# File 'lib/rider_server/request.rb', line 33 def set(key, value) @data[key] = value end |
#to_h ⇒ Object
57 58 59 |
# File 'lib/rider_server/request.rb', line 57 def to_h @data end |