Module: Rufus::Tokyo::TyrantCommons

Included in:
Edo::NetTyrant, Edo::NetTyrantTable, Tyrant, TyrantTable
Defined in:
lib/rufus/tokyo/ttcommons.rb

Overview

#stat and #compte_ext_opts, that’s all.

Instance Method Summary collapse

Instance Method Details

#compute_ext_opts(opts) ⇒ Object

Computes the :int option for the “ext” function (triggering tyrant embedded lua functions)



49
50
51
52
53
54
55
# File 'lib/rufus/tokyo/ttcommons.rb', line 49

def compute_ext_opts (opts)

  r = 0
  r = r | 1 if opts[:record_locking]
  r = r | 2 if opts[:global_locking]
  r
end

#statObject

Returns a hash of information about the Tokyo Tyrant database (or table) at the other end of the connection.



37
38
39
40
41
42
43
44
# File 'lib/rufus/tokyo/ttcommons.rb', line 37

def stat

  do_stat.split("\n").inject({}) { |r, l|
    kv = l.split("\t")
    r[kv.first] = kv.last
    r
  }
end