Class: GroongaClientModel::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/groonga_client_model/client.rb

Defined Under Namespace

Modules: Notifiable

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url = nil) ⇒ Client

Returns a new instance of Client.



28
29
30
# File 'lib/groonga_client_model/client.rb', line 28

def initialize(url=nil)
  @url = url || self.class.url || "http://127.0.0.1:10041"
end

Instance Attribute Details

#urlObject (readonly)

Returns the value of attribute url.



27
28
29
# File 'lib/groonga_client_model/client.rb', line 27

def url
  @url
end

Class Method Details

.open(&block) ⇒ Object



22
23
24
# File 'lib/groonga_client_model/client.rb', line 22

def open(&block)
  new.open(&block)
end

Instance Method Details

#openObject



32
33
34
35
36
37
# File 'lib/groonga_client_model/client.rb', line 32

def open
  Groonga::Client.open(url: @url) do |client|
    client.extend(Notifiable)
    yield(client)
  end
end