This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'odba/persistable' | |
require 'thread' | |
module ODBA | |
class IdServer | |
include Persistable | |
ODBA_SERIALIZABLE = ['@ids'] | |
ODBA_EXCLUDE_VARS = ['@mutex'] | |
def initialize | |
@ids = {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def to_obj(ref) | |
test = ref | |
if(test.is_a?(String) || (test = @unsaved[ref])) | |
DRbWrapper.new(ODBA.cache.fetch(test.to_i)) | |
else | |
super | |
end | |
rescue RuntimeError => e | |
raise RangeError, e.message | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def update_condition_index(index_name, origin_id, search_terms, target_id) | |
keys = [] | |
vals = [] | |
search_terms.each { |key, val| | |
keys.push(key) | |
vals.push(val) | |
} | |
if(target_id) | |
self.dbi.do <<-SQL, origin_id, target_id, *vals | |
INSERT INTO #{index_name} (origin_id, target_id, #{keys.join(', ')}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def proc_resolve_search_term # :nodoc: | |
if(@proc_resolve_search_term.nil?) | |
src = <<-EOS | |
Proc.new { |origin| | |
values = {} | |
EOS | |
@resolve_search_term.each { |name, info| | |
src << <<-EOS | |
begin | |
values.store('#{name}', origin.#{info['resolve']}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A Persistable instance can be _prefetchable_. This means that the object | |
# can be loaded at startup by calling ODBA.cache.prefetch, and that it will | |
# never expire from the Cache. The prefetch status can be controlled per | |
# instance by setting the instance variable @odba_prefetch, and per class by | |
# overriding the module constant ODBA_PREFETCH | |
def odba_prefetch? | |
@odba_prefetch \ | |
|| (defined?(self::class::ODBA_PREFETCH) && self::class::ODBA_PREFETCH) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def odba_target_ids | |
ids = super | |
self.each { |value| | |
if(value.is_a?(ODBA::Persistable)) | |
ids.push(value.odba_id) | |
end | |
} | |
ids.uniq | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Object # :nodoc: all | |
def odba_id | |
end | |
def odba_instance | |
self | |
end | |
def odba_isolated_stub | |
self | |
end | |
def metaclass; class << self; self; end; end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ==(other) # :nodoc: | |
super(other.odba_instance) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
||= [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## changes to excel/writer/worksheet.rb by fonsan | |
module Spreadsheet | |
module Excel | |
module Writer | |
def write_cellblocks row | |
# BLANK ➜ 6.7 | |
# BOOLERR ➜ 6.10 | |
# INTEGER ➜ 6.56 (BIFF2 only) | |
# LABEL ➜ 6.59 (BIFF2-BIFF7) |