Class: BitClust::FunctionEntry

Inherits:
Entry show all
Defined in:
lib/bitclust/functionentry.rb

Constant Summary

Constants included from NameUtils

NameUtils::CHAR_TO_MARK, NameUtils::CHAR_TO_NAME, NameUtils::CLASS_NAME_RE, NameUtils::CLASS_PATH_RE, NameUtils::CONST_PATH_RE, NameUtils::CONST_RE, NameUtils::GVAR_RE, NameUtils::LIBNAME_RE, NameUtils::MARK_TO_CHAR, NameUtils::MARK_TO_NAME, NameUtils::METHOD_NAME_RE, NameUtils::METHOD_SPEC_RE, NameUtils::MID, NameUtils::NAME_TO_CHAR, NameUtils::NAME_TO_MARK, NameUtils::TYPEMARK_RE

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Entry

#detail_source, #encoding, #loaded?, persistent_properties, property, #save, #synopsis_source, #type_id

Methods included from NameUtils

build_method_id, classid2name, classname2id, classname?, decodeid, decodename_fs, decodename_url, encodeid, encodename_fs, encodename_rdocurl, encodename_url, functionname?, gvarname?, html_filename, libid2name, libname2id, libname?, method_spec?, methodid2classid, methodid2libid, methodid2mname, methodid2specparts, methodid2specstring, methodid2typechar, methodid2typemark, methodid2typename, methodname?, split_method_id, split_method_spec, typechar2mark, typechar2name, typechar?, typemark2char, typemark2name, typemark?, typename2char, typename2mark, typename?

Constructor Details

#initialize(db, id) ⇒ FunctionEntry

Returns a new instance of FunctionEntry.


21
22
23
24
25
# File 'lib/bitclust/functionentry.rb', line 21

def initialize(db, id)
  super db
  @id = id
  init_properties
end

Instance Attribute Details

#idObject (readonly) Also known as: name, label

Returns the value of attribute id


49
50
51
# File 'lib/bitclust/functionentry.rb', line 49

def id
  @id
end

Class Method Details

.type_idObject


17
18
19
# File 'lib/bitclust/functionentry.rb', line 17

def FunctionEntry.type_id
  :function
end

Instance Method Details

#<=>(other) ⇒ Object


35
36
37
# File 'lib/bitclust/functionentry.rb', line 35

def <=>(other)
  @id.casecmp(other.id)
end

#callable?Boolean

Returns:

  • (Boolean)

61
62
63
# File 'lib/bitclust/functionentry.rb', line 61

def callable?
  not params().empty?
end

#headerObject


70
71
72
73
74
75
76
77
# File 'lib/bitclust/functionentry.rb', line 70

def header
  if callable?
    base = "#{type()} #{name()}#{params()}"
  else
    base = "#{type()} #{name()}"
  end
  "#{private? ? 'static ' : ''}#{base}"
end

#inspectObject


27
28
29
# File 'lib/bitclust/functionentry.rb', line 27

def inspect
  "\#<function #{@id}>"
end

#name_match?(re) ⇒ Boolean

Returns:

  • (Boolean)

31
32
33
# File 'lib/bitclust/functionentry.rb', line 31

def name_match?(re)
  re =~ name()
end

#public?Boolean

Returns:

  • (Boolean)

57
58
59
# File 'lib/bitclust/functionentry.rb', line 57

def public?
  not private?
end

#type_labelObject Also known as: kind


65
66
67
# File 'lib/bitclust/functionentry.rb', line 65

def type_label
  macro? ? 'macro' : 'function'
end