Skip to content

Commit f5972d8

Browse files
authored
Merge pull request #255 from Affonso-Gui/method-search-branch
Add pattern option in :methods
2 parents fab69d9 + 08ed399 commit f5972d8

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

doc/jlatex/jobjects.tex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ \subsection{基本クラス}
242242
このリストに{\bf assoc}を適用することにより、スロットの詳細値が得られる。
243243
しかしながら、それらを変更することはできない。}
244244

245+
\methoddesc{:methods}{\&optional subname}{
246+
このオブジェクトから呼べる全てのメソッドのリストを返す。
247+
{\em subname}を指定すると、メソッド名のなかにそれを含むメソッドのみ返す。}
248+
245249
\classdesc{propertied-object}{object}
246250
{plist}
247251
{property-listを持つオブジェクトを定義する。

doc/latex/objects.tex

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,8 @@ \subsection{Basic Classes}
283283
\methoddesc{:slots}{}{
284284
returns a list of variable and value pairs of this object.}
285285

286-
\methoddesc{:methods}{}{
287-
returns a list of all method names defined for this object.
288-
In other words, this object can accept method calls listed by :methods. }
286+
\methoddesc{:methods}{\&optional subname}{
287+
returns a list of all methods callable by this object. If {\em subname} is given, returns only methods with names that include {\em subname}. }
289288

290289
\methoddesc{:get-val}{variable-name}{
291290
returns the value of the slot designated by {\it variable-name}.

lisp/l/object.l

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@
2626
(dotimes (i (length vars))
2727
(push (cons (elt vars i) (slot self (class self) i)) slots))
2828
(nreverse slots)))
29-
(:methods () (apply #'append (mapcar #'cadr (send (class self) :all-method-names))))
29+
(:methods (&optional (pattern ""))
30+
"(self class &optional (pattern \"\"))
31+
Returns the list of all methods callable by the object. If pattern is given, returns only methods with names that include pattern."
32+
(mapcan #'cadr (send (class self) :all-method-names pattern)))
3033
;; (:all-methods () (send (class self) :all-method-names))
3134
(:super () (send (class self) :super))
3235
(:get-val (s) (slot self (class self) s))

0 commit comments

Comments
 (0)