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

395 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada 3ad54239b5 [ruby/win32ole] [DOC] Move sample to toplevel
https://github.com/ruby/win32ole/commit/70ea60c4d2
2024-01-28 15:25:36 +00:00
Hiroshi SHIBATA 9f02680015
Removed sample code for net-imap. net-imap is alread extracted as bundled gems 2024-01-16 17:09:35 +09:00
Hiroshi SHIBATA 4b6936aa04 Unbundled samples for getoptlong 2024-01-16 17:07:10 +09:00
Yusuke Endoh b6704201a3 Add all-ruby-quine as a sample code
This sample code works on all release versions of Ruby, from Ruby 0.49.
2023-02-27 11:20:42 +09:00
Thomas R. Koll f03dd4ee77
Refactor dir.rb sample (#6977) [ci skip]
* Refactor dir.rb sample

The original (1998) sample with a for-loop and use of case/when isn't what we'd write nowadays

* [DOC] Update sample/dir.rb [ci skip]

Do not leave a `Dir` opened.

* [DOC] Update sample/dir.rb [ci skip]

Fix ArgumentError.

---------

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2023-02-15 12:41:53 +09:00
Yusuke Endoh af4cd997a1 sample/trick2022/03-mame/entry.rb: remove trailing spaces 2022-12-24 03:19:45 +09:00
Yusuke Endoh e8b0180974 sample/trick2022/: adds the top-three entries of TRICK 2022
See https://github.com/tric/trick2022 for TRICK 2022.
2022-12-24 03:19:45 +09:00
Nobuyoshi Nakada 0b767d743f
Use io/console to avoid stty error [ci skip] 2022-12-05 19:23:16 +09:00
Nobuyoshi Nakada d752cf7601 Use class methods of `File` over `Kernel.open` and `IO.read` 2022-12-01 02:28:49 +09:00
Yusuke Endoh 267452e6fe Sync TRICK 2018 (02-mame)
https://github.com/tric/trick2018/pull/5
2022-11-05 23:18:32 +09:00
Yudai Takada 3bceae0fad
Fix typo in README (#5925)
"iteretor" -> "iterator"
2022-05-20 14:45:46 -07:00
Hiroshi SHIBATA f7539d5758 [ruby/getoptlong] ruby/ruby used sample, not examples
https://github.com/ruby/getoptlong/commit/39faa7b390
2022-05-09 07:13:55 +09:00
Nobuyoshi Nakada 40e7aefeba Remove obsolete Fixnum and Bignum 2021-12-28 18:35:03 +09:00
Nobuyoshi Nakada e9a13332e8
Fix typos [ci skip] 2021-11-03 19:11:45 +09:00
Kevin Newton f4b88959d5 Clean up lambda output from exyacc.rb
The `lambda_body` grammar rule has a `"}"`, which is throwing off the `exyacc.rb` regular expressions. This changes the regular expression to account for `"}"` as well, which makes the output of `ruby sample/exyacc.rb < parse.y` change by the following diff:

```diff
632,634d631
< 		    ", &@3);
< 			$$ = $2;
< 		    }
```

Which makes it closer to a valid EBNF.
2021-08-25 18:23:56 -07:00
Nobuyoshi Nakada 9eae8cdefb
Prefer qualified names under Thread 2021-06-29 11:41:10 +09:00
Kenichi Kamiya ec4a41c4dd [Doc] Fix a typo s/interseting/interesting/ 2021-03-22 15:33:32 +09:00
Kazuki Yamaguchi 7f0b3fb906 [ruby/openssl] sample: update obsolete API use
https://github.com/ruby/openssl/commit/dafa851c0d
2021-03-16 19:37:06 +09:00
Kazuki Yamaguchi e35d3623de [ruby/openssl] sample: avoid "include OpenSSL"
It is not a common practice and should not be done since it causes name
clash: for example, Digest and Random are provided by other standard
libraries of Ruby.

Fixes: https://github.com/ruby/openssl/issues/419

https://github.com/ruby/openssl/commit/6a6444984b
2021-03-16 19:37:06 +09:00
Kazuki Yamaguchi 10d360847b [ruby/openssl] pkey: prefer PKey.read over PKey::RSA.new in docs
https://github.com/ruby/openssl/commit/cf92a3ffba
2021-03-16 19:16:10 +09:00
Sutou Kouhei a4a6cb036e Remove samples for test-unit
They are no longer needed.
2021-01-17 06:08:21 +09:00
Sutou Kouhei f2767cf091 Move rss samples to ruby/rss 2021-01-17 06:07:54 +09:00
Yusuke Endoh a8fc72f5a8 sample/trick2015/kinaba/entry.rb: The constant "Data" has been removed
Instead, use "Proc" as a 4-letter constant.
2020-12-24 01:51:46 +09:00
Kazuhiro NISHIYAMA 144b11e03e
Fix `warning: instance variable @head not initialized` and remove unused instance variable 2020-12-19 15:24:09 +09:00
Hiroshi SHIBATA 05cc58c2eb webrick was removed from ruby repo 2020-12-10 18:06:25 +09:00
Kazuhiro NISHIYAMA 3353baac3d
Use own mutex instead of Thread.exclusive
ref [Feature #17125]
2020-08-27 14:37:03 +09:00
Kazuhiro NISHIYAMA 946cd6c534
Use https instead of http 2020-07-28 19:51:54 +09:00
Bart de Water 0b2c70eaa1 [ruby/openssl] Look up digest by name instead of constant
https://github.com/ruby/openssl/commit/b28fb2f05c
2020-05-13 15:47:51 +09:00
Nobuyoshi Nakada db16629008
Fixed misspellings
Fixed misspellings reported at [Bug #16437], only in ruby and rubyspec.
2019-12-20 09:32:42 +09:00
David Rodríguez f48655d04d Remove unneeded exec bits from some files
I noticed that some files in rubygems were executable, and I could think
of no reason why they should be.

In general, I think ruby files should never have the executable bit set
unless they include a shebang, so I run the following command over the
whole repo:

```bash
find . -name '*.rb' -type f -executable -exec bash -c 'grep -L "^#!" $1 || chmod -x $1' _ {} \;
```
2019-11-09 21:36:30 +09:00
Kazuhiro NISHIYAMA cc8116b03e Fix a typo [ci skip] 2019-11-01 18:33:58 +09:00
Jeremy Evans 71d97a5ef8 Fix sample/drb/http0serv.rb
Previously, trying to use this would result in:

undefined method `uri' for #<DRb::HTTP0::ServerSide:0x00000aec9f1637f8> (NoMethodError)

Also, use a relative require to load sample/drb/http0.rb.

Fixes [Bug #13431]
2019-08-25 10:56:47 -07:00
Kenichi Kamiya 8882986d97 Drop duplicated sample code (#2389) [ci skip]
* Drop duplicated sample code

* Drop another style sample

https://github.com/ruby/ruby/pull/2389#issuecomment-522489520

* Update sample list
2019-08-19 18:43:23 +09:00
Kenichi Kamiya 9b330200f8 Remove unused variable to suppress warning (#2388) [ci skip]
```
sample/observ.rb:30: warning: assigned but unused variable - clock
```
2019-08-19 18:16:45 +09:00
Kenichi Kamiya cda8664471 Update a sample code (#2387)
Kernel#inspect does not call #to_s now

To follow fd7dc23d28
2019-08-19 18:00:29 +09:00
Kenichi Kamiya 605d2ce9b9 Accurate a sample to show having some ext (#2385) 2019-08-19 17:30:59 +09:00
Kenichi Kamiya 9d20d2b0f5 Clean sample code biorhythm (#2375)
* Standardize to load date libary code

> git grep 'require .date.' | wc -l
179
> git grep 'require .date\.rb' | wc -l
1

* Simplify
2019-08-17 15:03:00 +09:00
Kenichi Kamiya 72adc6cffb Simplify a sample code (#2374) 2019-08-17 14:56:57 +09:00
ko1 8bda94f78c For this may be a syntax error (instead of LocalJumpError) in Ruby 2.7
[Fix GH-2078]

This patch is from Yutaka HARA <yutaka.hara+github@gmail.com>.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-04 06:28:57 +00:00
kazu d1dce26b94 sample/fib.py: Fix syntax error in Python 3 [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-18 23:36:47 +00:00
mame a8812080c4 Fix typo in trick2018/README [ci skip]
s/dimentional/dimensional

From: "yuuji.yaginuma" <yuuji.yaginuma@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-03 10:35:13 +00:00
mame 1c26ca1e7e sample/trick2013/mame/music-box.mp4: removed
The tarball will be reduced by about 568 kB.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-03 01:59:29 +00:00
mame 7d5fad1bc5 sample/trick2018/03-tompng: merge upstream fixes
* Remove `ruby '2.5.0'`
* Add `source 'https://rubygems.org'`
* Avoid `Kernel#Integer`

Thanks to tompng.  Fixes #14930.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-17 14:35:02 +00:00
kazu 5b666803f1 Fix a typo [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-23 09:49:45 +00:00
svn c5229a942b * append newline at EOF.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-21 13:07:52 +00:00
mame e613cdd53d sample/trick2018/: adds the top-five entries of TRICK 2018
See https://github.com/tric/trick2018 for TRICK 2018.
Fixes #14930.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-21 13:07:50 +00:00
kazu 9d091c851a sample/timeout.rb: Remove unnecessary increment [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62898 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-22 13:01:17 +00:00
kazu 23358107f9 sample/timeout.rb: fix warnings
warning: Object#timeout is deprecated, use Timeout.timeout instead.
[ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62780 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-16 14:09:40 +00:00
k0kubun cc777d09f4 erb.rb: deprecate safe_level of ERB.new
Also, as it's in the middle of the list of 4 arguments, 3rd and 4th arguments
(trim_mode, eoutvar) are changed to keyword arguments.
Old ways to specify arguments are deprecated and warned now.

bin/erb: deprecate -S option.

We'll remove all of deprecated ones at Ruby 2.7+.

enc/make_encmake.rb: stopped using deprecated interface
ext/etc/mkconstants.rb: ditto
ext/socket/mkconstants.rb: ditto
sample/ripper/ruby2html.rb: ditto
spec/ruby/library/erb/defmethod/def_erb_method_spec.rb: ditto
spec/ruby/library/erb/new_spec.rb: ditto
test/erb/test_erb.rb: ditto
test/erb/test_erb_command.rb: ditto
tool/generic_erb.rb: ditto
tool/ruby_vm/helpers/dumper.rb: ditto
tool/transcode-tblgen.rb: ditto
lib/rdoc/erbio.rb: ditto
lib/rdoc/generator/darkfish.rb: ditto

[Feature #14256]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-22 13:28:25 +00:00
normal 3f059374b8 sample/iseq_loader: use File.open instead of Kernel#open
This makes auditing for inadvertant command execution
easier.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-12 09:31:22 +00:00