Class: AssLauncher::Enterprise::Ole::IbConnection

Inherits:
Object
  • Object
show all
Defined in:
lib/ass_launcher/enterprise/ole.rb

Overview

1C Infobase External Connection

Direct Known Subclasses

AgentConnection, ThinApplication, WpConnection

Instance Method Summary collapse

Constructor Details

#initialize(requirement) ⇒ Object

Parameters:

  • requirement (Gem::Version::Requirement)

    version of 1C Ole server



22
23
24
# File 'lib/ass_launcher/enterprise/ole.rb', line 22

def initialize(requirement)
  @requirement = requirement.to_s
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object (protected)

Try call ole method

Raises:

  • (RuntimeError)

    if object closed



83
84
85
86
87
# File 'lib/ass_launcher/enterprise/ole.rb', line 83

def method_missing(method, *args)
  fail "Attempt call method for closed object #{self.class.name}"\
    if __closed__?
  __ole__.send(method, *args)
end

Instance Method Details

#__close__Object

Note:

It not guaranteed real closing connection! Connection keep alive while have any alive WIN32OLE refs generated this connection. WIN32OLE#_<em>ass_ole_free</em>_ try kill refs but it work not always

Try close connection.

See Also:



46
47
48
49
50
51
# File 'lib/ass_launcher/enterprise/ole.rb', line 46

def __close__
  return true if __closed__?
  __ole__.send :__ass_ole_free__
  @__ole__ = nil
  true
end

#__closed__?Boolean

True if connection closed

Returns:

  • (Boolean)


54
55
56
# File 'lib/ass_launcher/enterprise/ole.rb', line 54

def __closed__?
  __ole__.nil?
end

#__configure_com_connector__(opts) ⇒ Object

Set 1C Ole server properties



64
65
66
67
68
# File 'lib/ass_launcher/enterprise/ole.rb', line 64

def __configure_com_connector__(opts)
  opts.each do |k, v|
    __ole_binary__.ole.setproperty(k, v)
  end
end

#__open__(conn_str) ⇒ Object

Open connection in to infobase described in conn_str



29
30
31
32
33
# File 'lib/ass_launcher/enterprise/ole.rb', line 29

def __open__(conn_str)
  return true if __opened__?
  __init_ole__(__ole_binary__.ole.connect(__cs__(conn_str)))
  true
end

#__opened__?Boolean

True if connection opened

Returns:

  • (Boolean)


59
60
61
# File 'lib/ass_launcher/enterprise/ole.rb', line 59

def __opened__?
  !__closed__?
end