Class: Ork::Connection
- Inherits:
-
Object
- Object
- Ork::Connection
- Defined in:
- lib/ork/connection.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(context = :main, options = {}) ⇒ Connection
constructor
A new instance of Connection.
- #reset! ⇒ Object
- #riak ⇒ Object
- #start(context, options = {}) ⇒ Object
- #threaded ⇒ Object
Constructor Details
#initialize(context = :main, options = {}) ⇒ Connection
Returns a new instance of Connection.
5 6 7 8 |
# File 'lib/ork/connection.rb', line 5 def initialize(context = :main, = {}) @context = context @options = end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
3 4 5 |
# File 'lib/ork/connection.rb', line 3 def context @context end |
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/ork/connection.rb', line 3 def @options end |
Instance Method Details
#reset! ⇒ Object
10 11 12 |
# File 'lib/ork/connection.rb', line 10 def reset! threaded[context] = nil end |
#riak ⇒ Object
20 21 22 |
# File 'lib/ork/connection.rb', line 20 def riak threaded[context] ||= Riak::Client.new() end |
#start(context, options = {}) ⇒ Object
14 15 16 17 18 |
# File 'lib/ork/connection.rb', line 14 def start(context, = {}) self.context = context self. = self.reset! end |
#threaded ⇒ Object
24 25 26 |
# File 'lib/ork/connection.rb', line 24 def threaded Thread.current[:ork] ||= {} end |