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
-
#id ⇒ Object
(also: #name, #label)
readonly
Returns the value of attribute id.
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
Returns a new instance of FunctionEntry.
22
23
24
25
26
|
# File 'lib/bitclust/functionentry.rb', line 22
def initialize(db, id)
super db
@id = id
init_properties
end
|
Instance Attribute Details
#id ⇒ Object
Also known as:
name, label
Returns the value of attribute id.
51
52
53
|
# File 'lib/bitclust/functionentry.rb', line 51
def id
@id
end
|
Class Method Details
18
19
20
|
# File 'lib/bitclust/functionentry.rb', line 18
def FunctionEntry.type_id
:function
end
|
Instance Method Details
#<=>(other) ⇒ Object
36
37
38
|
# File 'lib/bitclust/functionentry.rb', line 36
def <=>(other)
@id.casecmp(other.id)
end
|
#callable? ⇒ Boolean
63
64
65
|
# File 'lib/bitclust/functionentry.rb', line 63
def callable?
not params().empty?
end
|
#description ⇒ Object
81
82
83
|
# File 'lib/bitclust/functionentry.rb', line 81
def description
source.split(/\n\n+/, 2)[0].strip
end
|
72
73
74
75
76
77
78
79
|
# File 'lib/bitclust/functionentry.rb', line 72
def
if callable?
base = "#{type()} #{name()}#{params()}"
else
base = "#{type()} #{name()}"
end
"#{private? ? 'static ' : ''}#{base}"
end
|
28
29
30
|
# File 'lib/bitclust/functionentry.rb', line 28
def inspect
"\#<function #{@id}>"
end
|
#name_match?(re) ⇒ Boolean
32
33
34
|
# File 'lib/bitclust/functionentry.rb', line 32
def name_match?(re)
re =~ name()
end
|
#public? ⇒ Boolean
59
60
61
|
# File 'lib/bitclust/functionentry.rb', line 59
def public?
not private?
end
|
#type_label ⇒ Object
Also known as:
kind
67
68
69
|
# File 'lib/bitclust/functionentry.rb', line 67
def type_label
macro? ? 'macro' : 'function'
end
|