Method: TALibFFI.function_table

Defined in:
lib/ta_lib_ffi.rb

.function_table(group) ⇒ Array<String>

Returns a list of all functions in a specific group

Parameters:

  • group (String)

    The name of the group to get functions for

Returns:

  • (Array<String>)

    Array of function names in the group



259
260
261
262
263
264
265
266
267
268
269
270
# File 'lib/ta_lib_ffi.rb', line 259

def function_table(group)
  string_table_ptr = Fiddle::Pointer.malloc(Fiddle::SIZEOF_VOIDP)
  ret_code = TA_FuncTableAlloc(group, string_table_ptr.ref)
  check_ta_return_code(ret_code)

  string_table = TA_StringTable.new(string_table_ptr)
  func_names = Fiddle::Pointer.new(string_table["string"])[0, Fiddle::SIZEOF_VOIDP * string_table["size"]].unpack("Q*").collect { |ptr| Fiddle::Pointer.new(ptr).to_s }

  TA_FuncTableFree(string_table)

  func_names
end