01: /*
02: * RubyTag.java
03: *
04: * Copyright (C) 2002 Jens Luedicke <jens@irs-net.com>
05: * based on PythonTag.java
06: * $Id: RubyTag.java,v 1.1.1.1 2002/09/24 16:08:19 piso Exp $
07: *
08: * This program is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU General Public License
10: * as published by the Free Software Foundation; either version 2
11: * of the License, or (at your option) any later version.
12: *
13: * This program is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: * GNU General Public License for more details.
17: *
18: * You should have received a copy of the GNU General Public License
19: * along with this program; if not, write to the Free Software
20: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21: */
22:
23: package org.armedbear.j;
24:
25: public final class RubyTag extends LocalTag {
26: public RubyTag(String name, Position pos, int type) {
27: super (name, pos, type);
28: }
29:
30: public String getLongName() {
31: if (name.startsWith("class "))
32: return name;
33: String s = signature.trim();
34: if (s.startsWith("def ") || s.startsWith("def\t"))
35: s = s.substring(4).trim();
36: // Strip comment if any.
37: int index = s.indexOf('#');
38: if (index >= 0)
39: s = s.substring(0, index).trim();
40: index = s.indexOf(')');
41: if (index >= 0)
42: s = s.substring(0, index + 1);
43: if (s.endsWith("("))
44: s = s.substring(0, s.length() - 1);
45: return s;
46: }
47: }
|