Граф коммитов

323 Коммитов

Автор SHA1 Сообщение Дата
marcandre ffd86054f5 * object.c (rb_mod_attr_accessor, rb_mod_const_set): made rdoc
more precise by specifying Object can searched for Modules.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-27 13:55:21 +00:00
nobu 52f5f410e4 * internal.h: add for internal use only.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-18 13:41:54 +00:00
nagachika 9fac3321a7 * object.c: format comments to keep 80 columns in a line.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-12 12:18:47 +00:00
drbrain 615e7987ca * object.c (rb_obj_equal): Add documentation. Patch by Vincent Batts.
[Ruby 1.9 - Bug #4664]
	* lib/rexml:  ditto
	* lib/mkmf.rb:  ditto
	* ext/socket/lib/socket.rb:  ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31525 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-11 22:56:13 +00:00
nagachika a64103fbfe * string.c (rb_String): Kernel#String should call to_str before to_s.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-29 12:56:40 +00:00
kosaki ac0178910e * object.c (rb_str_to_dbl): rewrite again. use ALLOCV instead
rb_str_tmp_new().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-27 12:46:30 +00:00
kosaki cab9751e97 * object.c (rb_str_to_dbl): Fix again. use rb_str_tmp_new()
instead ALLOC_N.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-24 18:23:05 +00:00
kosaki 2ec31553ea * object.c (rb_str_to_dbl): use ALLOC_N instead ALLOCA_N because
ALLOC_N may cause stack overflow.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-24 12:30:02 +00:00
marcandre af859f8d54 * object.c: Make BasicObject.new accept no parameter.
Revert of r26135 [ruby-core:27080], as per [ruby-core:32952].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-30 01:25:41 +00:00
mame b88c9aa1fe * object.c (Init_Object), constant.h, variable.c
(rb_mod_private_constant, rb_mod_public_constant,
  set_const_visibility, rb_const_get_0): add Module#public_constant
  and private_constant.  [ruby-dev:39685][ruby-core:32698]

* test/ruby/test_module.rb: add tests for above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-26 17:27:44 +00:00
mame a115768161 * class.c, constant.h, gc.c, method.h, object.c, variable.c,
vm_insnhelper.c: use struct rb_constant_entry_t as entry of
  RCLASS_CONST_TBL.  RCLASS_CONST_TBL has contained VALUE of constant
  directly.  Now instead rb_const_entry_t is contained in
  RCLASS_CONST_TBL,  rb_const_entry_t is managed by malloc, and
  have not only the value itself but also visibility flag.
  This is another preparation for private constant (see
  [ruby-dev:39685][ruby-core:32698]).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-26 17:27:32 +00:00
mame 2285a8d813 * class.c, gc.c, object.c, variable.c, vm_insnhelper.c,
include/ruby/ruby.h: separate RCLASS_CONST_TBL from RCLASS_IV_TBL.
  RCLASS_IV_TBL has contained not only instance variable table but
  also constant table.  Now the two table are separated to
  RCLASS_CONST_TBL and RCLASS_IV_TBL.  This is a preparation for
  private constant (see [ruby-dev:39685][ruby-core:32698]).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-26 17:27:21 +00:00
nobu 23e8deaf0d * array.c, gc.c, hash.c, object.c, string.c, struct.c,
transcode.c, variable.c, vm.c, vm_insnhelper.c, vm_method.c:
  replace calls to rb_error_frozen() with rb_check_frozen().  a
  patch from Run Paint Run Run at [ruby-core:32014]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-24 08:14:05 +00:00
nobu 671b498070 Commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19 03:25:29 +00:00
nobu 12cbb58819 * test/ruby/test_sprintf.rb: fix ML ref. [ruby-core:32848]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-19 03:22:03 +00:00
ryan a91ee12dd0 Improved doco for both Module.new and Class.new
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-18 06:56:41 +00:00
usa 3a297bb1f0 * object.c (rb_obj_class): remove mention of obsolete method.
a patch from Run Paint Run Run at [ruby-core:31842].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-27 03:27:50 +00:00
naruse b88a5027b8 Add rdoc about Kernel#<=> [ruby-core:31770]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-20 05:13:39 +00:00
nobu 492d8e67d7 * object.c (rb_f_integer): add example with base.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-06 22:02:25 +00:00
mame d35f8ea885 * object.c: Object#public_methods, private_methods, etc. returns
method ids that belong to the class or the singleton class(es) of
  the object.  [ruby-dev:41613]

* class.c: on the other hand, Module#public_instance_methods, etc.
  returns method ids that belong to the module itself (even if the
  module is singleton, it does not return method ids of super
  class(es); see [ruby-core:28837]).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-17 16:58:25 +00:00
nobu 45f6fbf339 * removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 18:51:39 +00:00
nari ca64478089 * gc.c : use simple lazy sweep algorithm for response performance
gain. See [ruby-dev:41067].

* object.c: FL_MARK of some objects by lazy sweep is copied when
  RVALUE is cloned. These objects are not marked in the mark phase.
  So delete FL_MARK.

* class.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-28 11:13:42 +00:00
nobu b4f1eaa493 * ext/openssl/lib/openssl/x509-internal.rb, lib/forwardable.rb,
lib/irb/cmd/fork.rb, lib/mutex_m.rb,
  lib/shell/process-controller.rb, lib/sync.rb, object.c: 
  suppress warnings patched by Benoit Daloze at [ruby-core:30366].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27967 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-23 08:48:44 +00:00
marcandre 7729de4d91 * array.c: Documentation: change => in call-seq to ->.
Harmonize "#=>" in examples. [ruby-core:30206]

* bignum.c: ditto

* class.c: ditto

* compar.c: ditto

* cont.c: ditto

* dir.c: ditto

* encoding.c: ditto

* enum.c: ditto

* enumerator.c: ditto

* error.c: ditto

* eval.c: ditto

* file.c: ditto

* gc.c: ditto

* io.c: ditto

* load.c: ditto

* marshal.c: ditto

* math.c: ditto

* numeric.c: ditto

* object.c: ditto

* pack.c: ditto

* proc.c: ditto

* process.c: ditto

* random.c: ditto

* range.c: ditto

* re.c: ditto

* ruby.c: ditto

* signal.c: ditto

* sprintf.c: ditto

* string.c: ditto

* struct.c: ditto

* thread.c: ditto

* time.c: ditto

* transcode.c: ditto

* variable.c: ditto

* vm_eval.c: ditto

* vm_method.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:07:33 +00:00
naruse 4d399f12d4 * object.c (rb_cstr_to_dbl): return 0.0 if hexadecimal and
baccheck is FALSE: Float("0x1p+0") works, but "0x1p+0".to_f
  doesn't. [ruby-dev:40650]

* util.c (ruby_strtod): allow hexdecimal integers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-01 04:32:43 +00:00
akr 0471422beb enable Object#inspect doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-23 14:00:35 +00:00
shugo a3e10f380a * object.c (rb_obj_singleton_class): new method
Kernel#singleton_class.  [ruby-core:21702]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-23 09:38:54 +00:00
akr 82488cf2b9 * object.c (rb_obj_hash): use LONG2FIX to avoid Bignum allocation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-21 00:24:44 +00:00
matz a7926befe0 * object.c (rb_obj_clone): call initialize_clone hook method to
call initialize_copy.

* object.c (rb_obj_dup): call initialize_dup hook.

* lib/delegate.rb (Delegator#initialize_clone): use new hook to
  implement deep copy.  [ruby-dev:40242]

* lib/delegate.rb (Delegator#initialize_dup): ditto.

* test/test_delegate.rb (TestDelegateClass#test_copy_frozen): add
  a test to ensure #clone copies frozen status.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-08 07:43:54 +00:00
marcandre fb2941a4ec * object.c (rb_class_initialize): Make sure BasicObject doesn't get initialized twice [ruby-core:27577]
* class.c (rb_class_init_copy): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-13 02:57:48 +00:00
marcandre b3c3dda3f4 * lib/object.c (rb_obj_cmp): Default <=> operator returns 0 if objects are == [ruby-core:24063]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-24 01:32:01 +00:00
marcandre dbf07b09fd * object.c: BasicObject#initialize accepts any number of arguments [ruby-core:27080]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-20 23:05:07 +00:00
akr b9e0294eda fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03 17:46:28 +00:00
marcandre 68b23a0de7 * object.c (convert_type): Cleanup unused variable
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-01 04:06:00 +00:00
matz 0580ba0611 * array.c (rb_ary_to_ary): do not use #respond_to? to detect
to_ary.  Just call.  [ruby-core:23738]

* eval.c (rb_check_funcall): new function with method existence
  check.  returns Qundef when the method does not exist.

* enumerator.c (enumerator_rewind): just call method, using
  rb_check_funcall().  [ruby-core:23738]

* error.c (exc_equal): ditto.

* object.c (convert_type): ditto.

* error.c (rb_name_err_mesg_new): export function.

* eval.c (make_exception): ditto.

* io.c (pop_last_hash): return early when the last argument is nil.

* io.c (rb_io_puts): treat T_STRING specially for small
  optimization. 

* vm_eval.c (raise_method_missing): skip method call if possible
  using rb_method_basic_definition_p().

* vm_eval.c (method_missing): ditto.

* test/ruby/test_rubyoptions.rb (TestRubyOptions#test_debug): test
  suites changed to ignore exceptions caused by just-call policy.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-29 04:55:10 +00:00
matz 51f033f853 * object.c (rb_obj_cmp): defines Object#<=>. [ruby-core:24063]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-24 16:48:05 +00:00
matz 7eac66b9c6 * object.c (rb_obj_inspect): print instance variables only when
Object#to_s is not overridden.  [ruby-core:24425]

* class.c (rb_obj_basic_to_s_p): new function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-21 20:17:27 +00:00
nobu b20521ddc5 * object.c (rb_obj_inspect): fixed rdoc about the case that to_s
is called.  [ruby-core:24425]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-21 10:32:53 +00:00
marcandre 72838c28bd * object.c (rb_mod_const_defined): rdoc fix
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-13 23:12:59 +00:00
matz 74926fefb7 * object.c (rb_f_integer): now Integer() takes optional base
argument.  base will be ignored for non string values.
  suggested by Sam Carr at RubyFoo Lounge at London.

* test/ruby/test_integer.rb (TestInteger#test_Integer): test
  updated.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-03 10:18:14 +00:00
nobu 31b7ae00c0 * include/ruby/st.h (st_hash_func): use st_index_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-08 13:10:04 +00:00
yugui e056ac59a7 * class.c: refactored singleton class related matters.
Handles eigenclasses and plain classes transparently.

  (make_metaclass): renamed from make_metametaclass.
  (METACLASS_OF): new utility macro
  (META_CLASS_OF_CLASS_CLASS): ditto.
  (ENSURE_EIGENCLASS): ditto.
  (make_singleton_class): extracted from rb_singleton_class.
  (boot_defclass): moved from object.c
  (Init_class_hierarchy): extracted from Init_Object.
  (rb_make_metaclass): refactored.
  (singleton_class_of): extracted from rb_singleton_class.
  (rb_singleton_class): refactored.
  (rb_define_singleton_method): it needs a metaclass only
  but not its metametaclass.

* object.c: booting class hierarchy was moved to class.c
  for keeping dependency between compilation units least.
  (Init_Object): extracting the booting into
  Init_class_hierarchy.
  (boot_defclass): moved to class.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-31 05:55:57 +00:00
nobu 9676023607 * random.c (random_rand): unified random_int and random_float.
[ruby-dev:39158].  and fixes [ruby-core:24655], [ruby-core:24677],
  [ruby-core:24679].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-26 10:20:30 +00:00
nobu e07cb859cc * suppressed shorten-64-to-32 warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-18 08:05:32 +00:00
nobu b1f618e9e5 * object.c (rb_to_integer, rb_check_to_integer): return Bignum
as-is.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-12 14:30:32 +00:00
matz a5e227edfe * hash.c (rb_hash_hash): documentation fix. a patch from
Marc-Andre Lafortune.  [ruby-core:23943]

* object.c (rb_mod_cmp): ditto.

* range.c (range_eq): ditto.

* string.c (rb_str_partition, rb_str_rpartition): ditto.

* struct.c (rb_struct_s_def): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-01 21:20:44 +00:00
yugui cbb56c7514 Doxy-comment
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-29 16:52:57 +00:00
yugui 2d42e704f4 Doxy-comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23902 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-29 16:39:28 +00:00
yugui 8bacaf1f5c * object.c: updated the diagram of metaclass hierarchy in rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-29 15:34:30 +00:00
akr 6eebf142e1 update rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-24 13:37:43 +00:00