diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-07-20 17:36:36 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-07-20 17:36:36 +0000 |
commit | c09cea5e1ba4e6d103fad9e6c6cbf29560abf78b (patch) | |
tree | f23af24cc3d193da3cc59197e065e2b986e8bb5d | |
parent | b5d9cbe8e8bb5c0eb826ce68a81aa5579359b5e8 (diff) | |
download | ruby-c09cea5e1ba4e6d103fad9e6c6cbf29560abf78b.tar.gz |
* object.c (rb_mod_attr): make Module#attr to be an alias to
attr_reader. [RCR#331]
* ruby.h: export classes/modules to implement sandbox.
[ruby-core:08283]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | error.c | 2 | ||||
-rw-r--r-- | ext/tk/sample/tcltklib/sample2.rb | 2 | ||||
-rw-r--r-- | file.c | 4 | ||||
-rw-r--r-- | lib/cgi.rb | 4 | ||||
-rw-r--r-- | lib/complex.rb | 4 | ||||
-rw-r--r-- | lib/drb/drb.rb | 2 | ||||
-rw-r--r-- | lib/ipaddr.rb | 2 | ||||
-rw-r--r-- | lib/irb/ruby-token.rb | 6 | ||||
-rw-r--r-- | lib/rdoc/parsers/parse_rb.rb | 9 | ||||
-rw-r--r-- | lib/shell.rb | 11 | ||||
-rw-r--r-- | lib/soap/mapping/registry.rb | 2 | ||||
-rw-r--r-- | lib/soap/mapping/rubytypeFactory.rb | 2 | ||||
-rw-r--r-- | lib/sync.rb | 12 | ||||
-rw-r--r-- | lib/tracer.rb | 4 | ||||
-rw-r--r-- | re.c | 4 | ||||
-rw-r--r-- | ruby.h | 11 | ||||
-rw-r--r-- | test/rss/test_xml-stylesheet.rb | 2 | ||||
-rw-r--r-- | variable.c | 2 |
18 files changed, 44 insertions, 41 deletions
@@ -255,7 +255,7 @@ VALUE rb_eNoMethodError; VALUE rb_eSecurityError; VALUE rb_eNotImpError; VALUE rb_eNoMemError; -static VALUE rb_cNameErrorMesg; +VALUE rb_cNameErrorMesg; VALUE rb_eScriptError; VALUE rb_eSyntaxError; diff --git a/ext/tk/sample/tcltklib/sample2.rb b/ext/tk/sample/tcltklib/sample2.rb index 444bb1eef7..110e81ebc4 100644 --- a/ext/tk/sample/tcltklib/sample2.rb +++ b/ext/tk/sample/tcltklib/sample2.rb @@ -41,7 +41,7 @@ class Othello [ 1, -1], [ 1, 0], [ 1, 1] ] - attr :com_disk, TRUE + attr_accessor :com_disk def initialize(othello) @othello = othello @@ -93,7 +93,7 @@ be_fchown(int fd, uid_t owner, gid_t group) VALUE rb_cFile; VALUE rb_mFileTest; -static VALUE rb_cStat; +VALUE rb_cStat; VALUE rb_get_path(VALUE obj) @@ -3991,7 +3991,7 @@ rb_stat_sticky(VALUE obj) return Qfalse; } -static VALUE rb_mFConst; +VALUE rb_mFConst; void rb_file_const(const char *name, VALUE value) diff --git a/lib/cgi.rb b/lib/cgi.rb index 825be5a0a8..04f0b5e7ce 100644 --- a/lib/cgi.rb +++ b/lib/cgi.rb @@ -964,11 +964,11 @@ class CGI end # Get the cookies as a hash of cookie-name=>Cookie pairs. - attr_accessor("cookies") + attr_accessor :cookies # Get the parameters as a hash of name=>values pairs, where # values is an Array. - attr("params") + attr_reader :params # Set all the parameters. def params=(hash) diff --git a/lib/complex.rb b/lib/complex.rb index 8832f17f82..516bbbfd89 100644 --- a/lib/complex.rb +++ b/lib/complex.rb @@ -400,10 +400,10 @@ class Complex < Numeric I = Complex(0,1) # The real part of a complex number. - attr :real + attr_reader :real # The imaginary part of a complex number. - attr :image + attr_reader :image alias imag image end diff --git a/lib/drb/drb.rb b/lib/drb/drb.rb index 04c353c04e..9690469e0c 100644 --- a/lib/drb/drb.rb +++ b/lib/drb/drb.rb @@ -972,7 +972,7 @@ module DRb def initialize(option) @option = option.to_s end - attr :option + attr_reader :option def to_s; @option; end def ==(other) diff --git a/lib/ipaddr.rb b/lib/ipaddr.rb index ea26b374ec..4decab54aa 100644 --- a/lib/ipaddr.rb +++ b/lib/ipaddr.rb @@ -84,7 +84,7 @@ class IPAddr IN6FORMAT = (["%.4x"] * 8).join(':') # Returns the address family of this IP address. - attr :family + attr_reader :family # Creates a new ipaddr containing the given network byte ordered # string form of an IP address. diff --git a/lib/irb/ruby-token.rb b/lib/irb/ruby-token.rb index 525d4df14c..0a297d28fa 100644 --- a/lib/irb/ruby-token.rb +++ b/lib/irb/ruby-token.rb @@ -29,9 +29,7 @@ module RubyToken @line_no = line_no @char_no = char_no end - attr :seek - attr :line_no - attr :char_no + attr :seek, :line_no, :char_no end class TkNode < Token @@ -58,7 +56,7 @@ module RubyToken end class TkOp < Token - attr :name, true + attr_accessor :name end class TkOPASGN < TkOp diff --git a/lib/rdoc/parsers/parse_rb.rb b/lib/rdoc/parsers/parse_rb.rb index 4fe5180ba6..0186b023a1 100644 --- a/lib/rdoc/parsers/parse_rb.rb +++ b/lib/rdoc/parsers/parse_rb.rb @@ -466,11 +466,10 @@ class RubyLex @exception_on_syntax_error = true end - attr :skip_space, true - attr :read_auto_clean_up, true - attr :exception_on_syntax_error, true - - attr :indent + attr_accessor :skip_space + attr_accessor :read_auto_clean_up + attr_accessor :exception_on_syntax_error + attr_reader :indent # io functions def line_no diff --git a/lib/shell.rb b/lib/shell.rb index 039f849ef5..9c6847c623 100644 --- a/lib/shell.rb +++ b/lib/shell.rb @@ -31,9 +31,7 @@ class Shell @verbose = true class << Shell - attr :cascade, true - attr :debug, true - attr :verbose, true + attr_accessor :cascade, :debug, :verbose # alias cascade? cascade alias debug? debug @@ -98,11 +96,8 @@ class Shell rehash end - attr :umask, true - attr :record_separator, true - - attr :verbose, true - attr :debug, true + attr_accessor :umask, :record_separator + attr_accessor :verbose, :debug def debug=(val) @debug = val diff --git a/lib/soap/mapping/registry.rb b/lib/soap/mapping/registry.rb index 823e80666d..a4183fea57 100644 --- a/lib/soap/mapping/registry.rb +++ b/lib/soap/mapping/registry.rb @@ -522,7 +522,7 @@ private list = (class << obj; self; end).ancestors - obj.class.ancestors unless list.empty? node.extraattr[RubyExtendName] = list.collect { |c| - if c.name.empty? + unless c.name raise TypeError.new("singleton can't be dumped #{ obj }") end c.name diff --git a/lib/soap/mapping/rubytypeFactory.rb b/lib/soap/mapping/rubytypeFactory.rb index 61c21d8b20..6c30f23a7b 100644 --- a/lib/soap/mapping/rubytypeFactory.rb +++ b/lib/soap/mapping/rubytypeFactory.rb @@ -262,7 +262,7 @@ private end def unknownobj2soap(soap_class, obj, info, map) - if obj.class.name.empty? + unless obj.class.name raise TypeError.new("can't dump anonymous class #{obj}") end singleton_class = class << obj; self; end diff --git a/lib/sync.rb b/lib/sync.rb index 566cfbfb2d..93474e1caa 100644 --- a/lib/sync.rb +++ b/lib/sync.rb @@ -232,13 +232,13 @@ module Sync_m end end - attr :sync_mode, true + attr_accessor :sync_mode - attr :sync_waiting, true - attr :sync_upgrade_waiting, true - attr :sync_sh_locker, true - attr :sync_ex_locker, true - attr :sync_ex_count, true + attr_accessor :sync_waiting + attr_accessor :sync_upgrade_waiting + attr_accessor :sync_sh_locker + attr_accessor :sync_ex_locker + attr_accessor :sync_ex_count private diff --git a/lib/tracer.rb b/lib/tracer.rb index 71aa49c306..22f32bf222 100644 --- a/lib/tracer.rb +++ b/lib/tracer.rb @@ -19,9 +19,9 @@ class Tracer @stdout = STDOUT @verbose = false class << self - attr :verbose, true + attr_accessor :verbose alias verbose? verbose - attr :stdout, true + attr_accessor :stdout end EVENT_SYMBOL = { @@ -19,7 +19,7 @@ #define MBCTYPE_SJIS 2 #define MBCTYPE_UTF8 3 -static VALUE rb_eRegexpError; +VALUE rb_eRegexpError; #define BEG(no) regs->beg[no] #define END(no) regs->end[no] @@ -730,7 +730,7 @@ make_regexp(const char *s, long len, int flags, int ce) * */ -static VALUE rb_cMatch; +VALUE rb_cMatch; static VALUE match_alloc(VALUE klass) @@ -644,7 +644,9 @@ RUBY_EXTERN VALUE rb_cBasicObject; RUBY_EXTERN VALUE rb_cObject; RUBY_EXTERN VALUE rb_cArray; RUBY_EXTERN VALUE rb_cBignum; +RUBY_EXTERN VALUE rb_cBinding; RUBY_EXTERN VALUE rb_cClass; +RUBY_EXTERN VALUE rb_cCont; RUBY_EXTERN VALUE rb_cDir; RUBY_EXTERN VALUE rb_cData; RUBY_EXTERN VALUE rb_cFalseClass; @@ -654,19 +656,23 @@ RUBY_EXTERN VALUE rb_cFloat; RUBY_EXTERN VALUE rb_cHash; RUBY_EXTERN VALUE rb_cInteger; RUBY_EXTERN VALUE rb_cIO; +RUBY_EXTERN VALUE rb_cMatch; RUBY_EXTERN VALUE rb_cMethod; RUBY_EXTERN VALUE rb_cModule; +RUBY_EXTERN VALUE rb_cNameErrorMesg; RUBY_EXTERN VALUE rb_cNilClass; RUBY_EXTERN VALUE rb_cNumeric; RUBY_EXTERN VALUE rb_cProc; RUBY_EXTERN VALUE rb_cRange; RUBY_EXTERN VALUE rb_cRegexp; +RUBY_EXTERN VALUE rb_cStat; RUBY_EXTERN VALUE rb_cString; +RUBY_EXTERN VALUE rb_cStruct; RUBY_EXTERN VALUE rb_cSymbol; RUBY_EXTERN VALUE rb_cThread; RUBY_EXTERN VALUE rb_cTime; RUBY_EXTERN VALUE rb_cTrueClass; -RUBY_EXTERN VALUE rb_cStruct; +RUBY_EXTERN VALUE rb_cUnboundMethod; RUBY_EXTERN VALUE rb_eException; RUBY_EXTERN VALUE rb_eStandardError; @@ -689,6 +695,9 @@ RUBY_EXTERN VALUE rb_eNotImpError; RUBY_EXTERN VALUE rb_eNoMemError; RUBY_EXTERN VALUE rb_eNoMethodError; RUBY_EXTERN VALUE rb_eFloatDomainError; +RUBY_EXTERN VALUE rb_eLocalJumpError; +RUBY_EXTERN VALUE rb_eSysStackError; +RUBY_EXTERN VALUE rb_eRegexpError; RUBY_EXTERN VALUE rb_eScriptError; RUBY_EXTERN VALUE rb_eNameError; diff --git a/test/rss/test_xml-stylesheet.rb b/test/rss/test_xml-stylesheet.rb index c88a858f56..791fded605 100644 --- a/test/rss/test_xml-stylesheet.rb +++ b/test/rss/test_xml-stylesheet.rb @@ -74,10 +74,12 @@ module RSS :media => "printer", :charset => "UTF-8", :alternate => "yes"},], ].each do |xsss| + p xsss doc = REXML::Document.new(make_sample_RDF) root = doc.root xsss.each do |xss| content = xss.collect do |key, name| + p [key, name] %Q[#{key}="#{name}"] end.join(" ") pi = REXML::Instruction.new("xml-stylesheet", content) diff --git a/variable.c b/variable.c index 95f4743e33..2374e3fe70 100644 --- a/variable.c +++ b/variable.c @@ -18,7 +18,7 @@ #include "st.h" #include "util.h" -static st_table *rb_global_tbl; +st_table *rb_global_tbl; st_table *rb_class_tbl; static ID autoload, classpath, tmp_classpath; |