Class: BitClust::MethodNamePattern
Overview
A MethodNamePattern has #klass, #type, #method and #library. All attributes are string. All attributes are 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
- #class? ⇒ Boolean
- #empty? ⇒ Boolean
-
#initialize(c = nil, t = nil, m = nil, lib = nil) ⇒ MethodNamePattern
constructor
A new instance of MethodNamePattern.
- #inspect ⇒ Object
- #match?(m) ⇒ Boolean
- #method? ⇒ Boolean
- #select_classes(cs) ⇒ Object
- #special_variable? ⇒ Boolean
Constructor Details
#initialize(c = nil, t = nil, m = nil, lib = nil) ⇒ MethodNamePattern
Returns a new instance of MethodNamePattern.
149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/bitclust/methodid.rb', line 149 def initialize(c = nil, t = nil, m = nil, lib = nil) @klass = c if c and c.empty? @klass = nil end @type = t @method = m if m and m.empty? @method = nil end @library = library @crecache = [] @mrecache = [] end |
Instance Attribute Details
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
164 165 166 |
# File 'lib/bitclust/methodid.rb', line 164 def klass @klass end |
#library ⇒ Object (readonly)
Returns the value of attribute library.
167 168 169 |
# File 'lib/bitclust/methodid.rb', line 167 def library @library end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
166 167 168 |
# File 'lib/bitclust/methodid.rb', line 166 def method @method end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
165 166 167 |
# File 'lib/bitclust/methodid.rb', line 165 def type @type end |
Instance Method Details
#class? ⇒ Boolean
199 200 201 |
# File 'lib/bitclust/methodid.rb', line 199 def class? @klass and (not @type and not @method) end |
#empty? ⇒ Boolean
195 196 197 |
# File 'lib/bitclust/methodid.rb', line 195 def empty? not @klass and not @type and not @method end |
#inspect ⇒ Object
169 170 171 |
# File 'lib/bitclust/methodid.rb', line 169 def inspect "#<pattern #{esc(@library)}.#{esc(@klass)}#{tesc(@type)}#{esc(@method)}>" end |
#match?(m) ⇒ Boolean
183 184 185 186 187 188 |
# File 'lib/bitclust/methodid.rb', line 183 def match?(m) (not @library or m.library.name?(@library)) and (not @klass or m.klass.name?(@klass)) and (not @type or m.typemark == @type) and (not @method or m.name?(@method)) end |
#method? ⇒ Boolean
203 204 205 |
# File 'lib/bitclust/methodid.rb', line 203 def method? @method or (@type and @type != '$') end |
#select_classes(cs) ⇒ Object
190 191 192 193 |
# File 'lib/bitclust/methodid.rb', line 190 def select_classes(cs) return cs unless @klass (cs, @klass, @crecache) end |
#special_variable? ⇒ Boolean
207 208 209 |
# File 'lib/bitclust/methodid.rb', line 207 def special_variable? @type == '$' end |