Class: OSC::Reservations::Batch
- Inherits:
-
Object
- Object
- OSC::Reservations::Batch
- Defined in:
- lib/osc/reservations/batch.rb
Overview
Batch server that utilizes reservations in the batch scheduler.
Instance Attribute Summary collapse
-
#server ⇒ String
readonly
The batch server to connect to.
Instance Method Summary collapse
-
#initialize(server, context = {}) ⇒ Batch
constructor
A new instance of Batch.
-
#method_missing(method_name, *arguments, &block) ⇒ Object
See if the method call exists as a key in @context.
-
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Checks if the method responds to an instance method, or is able to proxy it to @context.
Constructor Details
#initialize(server, context = {}) ⇒ Batch
Returns a new instance of Batch.
10 11 12 13 14 15 16 17 18 |
# File 'lib/osc/reservations/batch.rb', line 10 def initialize(server, context = {}) @server = server # symbolize keys @context = {} context.each do |key, value| @context[key.to_sym] = value end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *arguments, &block) ⇒ Object
See if the method call exists as a key in @context.
25 26 27 |
# File 'lib/osc/reservations/batch.rb', line 25 def method_missing(method_name, *arguments, &block) @context.fetch(method_name) { super } end |
Instance Attribute Details
#server ⇒ String (readonly)
Returns the batch server to connect to.
6 7 8 |
# File 'lib/osc/reservations/batch.rb', line 6 def server @server end |
Instance Method Details
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Checks if the method responds to an instance method, or is able to proxy it to @context.
34 35 36 |
# File 'lib/osc/reservations/batch.rb', line 34 def respond_to_missing?(method_name, include_private = false) @context.include?(method_name) || super end |