Class: BitClust::MethodSpec
Overview
A MethodSpec has #klass, #type, #method and #library. All attributes are string. #library is optional.
Instance Attribute Summary collapse
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#library ⇒ Object
readonly
Returns the value of attribute library.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object (also: #eql?)
- #constant? ⇒ Boolean
-
#display_name(version = nil) ⇒ Object
version はドキュメント対象の Ruby バージョン(DB の version プロパティ)。 指定すると module function の typemark を表示用に畳む (4.0 以降は "?."。NameUtils#display_typemark と同じ規則).
- #hash ⇒ Object
-
#initialize(c, t, m, library = nil) ⇒ MethodSpec
constructor
A new instance of MethodSpec.
- #inspect ⇒ Object
- #instance_method? ⇒ Boolean
- #match?(m) ⇒ Boolean
- #method? ⇒ Boolean
- #module_function? ⇒ Boolean
- #singleton_method? ⇒ Boolean
- #special_variable? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(c, t, m, library = nil) ⇒ MethodSpec
Returns a new instance of MethodSpec.
73 74 75 76 77 78 |
# File 'lib/bitclust/methodid.rb', line 73 def initialize(c, t, m, library = nil) @klass = c @type = t @method = m @library = library end |
Instance Attribute Details
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
80 81 82 |
# File 'lib/bitclust/methodid.rb', line 80 def klass @klass end |
#library ⇒ Object (readonly)
Returns the value of attribute library.
83 84 85 |
# File 'lib/bitclust/methodid.rb', line 83 def library @library end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
82 83 84 |
# File 'lib/bitclust/methodid.rb', line 82 def method @method end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
81 82 83 |
# File 'lib/bitclust/methodid.rb', line 81 def type @type end |
Instance Method Details
#<=>(other) ⇒ Object
115 116 117 |
# File 'lib/bitclust/methodid.rb', line 115 def <=>(other) [@klass, @type, @method] <=> [other.klass, other.type, other.method] end |
#==(other) ⇒ Object Also known as: eql?
102 103 104 105 106 107 |
# File 'lib/bitclust/methodid.rb', line 102 def ==(other) return false if self.class != other.class @klass == other.klass and @type == other.type and @method == other.method end |
#constant? ⇒ Boolean
140 141 142 |
# File 'lib/bitclust/methodid.rb', line 140 def constant? @type == '::' end |
#display_name(version = nil) ⇒ Object
version はドキュメント対象の Ruby バージョン(DB の version プロパティ)。 指定すると module function の typemark を表示用に畳む (4.0 以降は "?."。NameUtils#display_typemark と同じ規則)
96 97 98 99 100 |
# File 'lib/bitclust/methodid.rb', line 96 def display_name(version = nil) return "$#{@method}" if @type == '$' return "#{@klass}#{NameUtils.display_typemark(_ = @type, version)}#{@method}" if version to_s() end |
#hash ⇒ Object
111 112 113 |
# File 'lib/bitclust/methodid.rb', line 111 def hash to_s().hash end |
#inspect ⇒ Object
85 86 87 |
# File 'lib/bitclust/methodid.rb', line 85 def inspect "#<spec #{@klass}#{@type}#{@method}>" end |
#instance_method? ⇒ Boolean
128 129 130 |
# File 'lib/bitclust/methodid.rb', line 128 def instance_method? @type == '#' or @type == '.#' end |
#match?(m) ⇒ Boolean
119 120 121 122 |
# File 'lib/bitclust/methodid.rb', line 119 def match?(m) (not @type or @type == m.typemark) and (not @method or m.name?(@method)) end |
#method? ⇒ Boolean
136 137 138 |
# File 'lib/bitclust/methodid.rb', line 136 def method? singleton_method? or instance_method? end |
#module_function? ⇒ Boolean
132 133 134 |
# File 'lib/bitclust/methodid.rb', line 132 def module_function? @type == '.#' end |
#singleton_method? ⇒ Boolean
124 125 126 |
# File 'lib/bitclust/methodid.rb', line 124 def singleton_method? @type == '.' or @type == '.#' end |
#special_variable? ⇒ Boolean
144 145 146 |
# File 'lib/bitclust/methodid.rb', line 144 def special_variable? @type == '$' end |
#to_s ⇒ Object
89 90 91 |
# File 'lib/bitclust/methodid.rb', line 89 def to_s "#{@klass}#{@type}#{@method}" end |