summaryrefslogtreecommitdiff
path: root/doc/optparse/ruby/datetime.rb
diff options
context:
space:
mode:
Diffstat (limited to 'doc/optparse/ruby/datetime.rb')
-rw-r--r--doc/optparse/ruby/datetime.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/optparse/ruby/datetime.rb b/doc/optparse/ruby/datetime.rb
new file mode 100644
index 0000000000..b9b591d5f6
--- /dev/null
+++ b/doc/optparse/ruby/datetime.rb
@@ -0,0 +1,6 @@
+require 'optparse/date'
+parser = OptionParser.new
+parser.on('--datetime=DATETIME', DateTime) do |value|
+ p [value, value.class]
+end
+parser.parse!
ogheader'>2025-10-07[ruby/error_highlight] Improve English comments and messagesYusuke Endoh https://github.com/ruby/error_highlight/commit/5f976265ef 2025-08-28[ruby/error_highlight] Remove a branch for Ruby 3.1Yusuke Endoh https://github.com/ruby/error_highlight/commit/d3063cde62 2025-08-28[ruby/error_highlight] Drop Ruby 3.1 supportYusuke Endoh ... as it is already EOL https://github.com/ruby/error_highlight/commit/f15489216a 2025-08-28[ruby/error_highlight] Show a dedicated snippet for "wrong number of ↵Yusuke Endoh arguments" error This is an experimental implementation for https://bugs.ruby-lang.org/issues/21543. ``` test.rb:2:in 'Object#foo': wrong number of arguments (given 1, expected 2) (ArgumentError) caller: test.rb:6 | foo(1) ^^^ callee: test.rb:2 | def foo(x, y) ^^^ from test.rb:6:in 'Object#bar' from test.rb:10:in 'Object#baz' from test.rb:13:in '<main>' ``` https://github.com/ruby/error_highlight/commit/21e974e1c4 2025-01-29[ruby/error_highlight] Ensure first_line and last_line are setYusuke Endoh Fixes https://github.com/ruby/error_highlight/pull/58 https://github.com/ruby/error_highlight/commit/9ddc1f31a9 2025-01-21[ruby/error_highlight] Use `$stderr` instead of STDERR for Ractorwanabe https://github.com/ruby/error_highlight/commit/a221a4b0eb 2024-12-03[ruby/error_highlight] Bump versionYusuke Endoh https://github.com/ruby/error_highlight/commit/a8e9eb7f2f 2024-10-24[ruby/error_highlight] Rename the `ErrorHighlight::DefaultFormatter` setting ↵Guilherme Carreiro to `max_snippet_width` for clarity https://github.com/ruby/error_highlight/commit/e13cbd4335 2024-10-23[ruby/error_highlight] Adjust truncation, add opt-out mechanism, rename ↵Guilherme Carreiro methods, and prepare error highlighting to render on extremely small screens https://github.com/ruby/error_highlight/commit/c565340958 2024-10-23[ruby/error_highlight] Handle very long lines with errors in the middle of ↵Guilherme Carreiro the line https://github.com/ruby/error_highlight/commit/0657bc1afa 2024-10-23[ruby/error_highlight] Handle very long linesGuilherme Carreiro https://github.com/ruby/error_highlight/commit/383490a4b4 2024-09-24[ruby/error_highlight] Fix error with prism when method given no argumentsLuke Gruber such as: p = Proc.new This now matches the RubyVM::AbstractSyntaxTree behavior, which is not to highlight anything. https://github.com/ruby/error_highlight/commit/d5c592a1ba 2024-09-24[ruby/error_highlight] Prism added node_id and Node#breadth_first_search in ↵Adam Hess the 1.0 release. These methods are required for Prism to be able to find the method from the backtrace. https://github.com/ruby/prism/blob/main/CHANGELOG.md#100---2024-08-28 In practice you will likely only end up in this situation if you previously had pre-1.0 prism installed and upgrade Ruby to a version with Prism as the default parser. https://github.com/ruby/error_highlight/commit/cb574daf62 2024-07-11[PRISM] Use node ids for error highlightKevin Newton 2024-06-07[ruby/error_highlight] Trim trailing spaces in base.rbKevin Newton https://github.com/ruby/error_highlight/commit/8ce3f6f145 2024-06-07[ruby/error_highlight] Support for the prism compilerKevin Newton https://github.com/ruby/error_highlight/commit/69fbacfd49 2024-02-21Add error for iseqs compiled by prismKevin Newton 2023-12-09[ruby/error_highlight] Bump versionYusuke Endoh https://github.com/ruby/error_highlight/commit/942a723d32 2023-01-13[ruby/error_highlight] Identify which node in `Foo::Bar::Baz` causes a NameErrorYusuke Endoh In Ruby 3.2 or later, a nested constant access like `Foo::Bar::Baz` is compiled to one instruction by the optimization https://github.com/ruby/ruby/pull/6187 We try to spot which sub-node caues a NameError in question based on the constant name. We will give up if the same constant name is accessed in a nested access (`Foo::Foo`). Fixes https://github.com/ruby/error_highlight/pull/31 https://github.com/ruby/error_highlight/commit/0a4db7da0a 2022-11-14[ruby/error_highlight] Bump versionYusuke Endoh https://github.com/ruby/error_highlight/commit/5275078dc6 2022-11-14[ruby/error_highlight] Enable ErrorHighlight for TypeError/ArgumentError ↵Yusuke Endoh only after Ruby 3.2 ... because changing TypeError#message and ArgumentError#message is highly incompatible. https://github.com/ruby/error_highlight/commit/39aa897c7a 2022-11-08[ruby/error_highlight] Bump versionYusuke Endoh https://github.com/ruby/error_highlight/commit/59c291cce1 2022-10-31[ruby/error_highlight] Support nodes in `spot`eileencodes Fixes a bug where `spot` was using the wrong local variable. We want to use error highlight with code that has been eval'd, specifically ERB templates. We can recover the compiled source code of the ERB template but we need an API to pass the node into error highlight's `spot`. Required Ruby PR: https://github.com/ruby/ruby/pull/6593 https://github.com/ruby/error_highlight/commit/0b1b650a59 Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> 2022-08-19[ruby/error_highlight] Apply ErrorHighlight::CoreExt to TypeError and ↵Yusuke Endoh ArgumentError https://github.com/ruby/error_highlight/commit/defcaf1beb 2022-08-12[ruby/error_highlight] Add a note about the current limitation of ↵Yusuke Endoh ErrorHighlight.spot https://github.com/ruby/error_highlight/commit/489ce80a62 2022-08-10[ruby/error_highlight] Bump versionYusuke Endoh https://github.com/ruby/error_highlight/commit/6edf0a0a5d 2022-08-10[ruby/error_highlight] Make backtrace_location keyword workYusuke Endoh We had to keep backtrace_location before opts is overwritten. https://github.com/ruby/error_highlight/commit/2735e4681a 2022-08-10[ruby/error_highlight] Make ErrorHighlight.spot accept Exception ↵Yusuke Endoh (https://github.com/ruby/error_highlight/pull/25) ... and move things from core_ext.rb to base.rb. This will confine CRuby-dependent things to ErrorHighlight.spot. https://github.com/ruby/error_highlight/commit/22d1dd7824 2022-06-07[ruby/error_highlight] Use Exception#detailed_message instead of overriding ↵Yusuke Endoh #message (https://github.com/ruby/error_highlight/pull/24) See https://bugs.ruby-lang.org/issues/18564. Ref: https://github.com/ruby/did_you_mean/pull/177 https://github.com/ruby/error_highlight/commit/671b7c61b2 2022-01-04[ruby/error_highlight] Fix the spurious TypeError.Christian Boos When we have no backtrace locations, we can't have the highlight, so just return the message. https://github.com/ruby/error_highlight/commit/9f5c639494 2021-12-23[ruby/error_highlight] Bump versionYusuke Endoh https://github.com/ruby/error_highlight/commit/ae3053686f 2021-12-19Manually sync ↵Yusuke Endoh https://github.com/ruby/error_highlight/commit/d2140d795ad0a06398db81739201877d431755db 2021-12-19Make RubyVM::AbstractSyntaxTree.of raise for backtrace location in evalYusuke Endoh This check is needed to fix a bug of error_highlight when NameError occurred in eval'ed code. https://github.com/ruby/error_highlight/pull/16 The same check for proc/method has been already introduced since 64ac984129a7a4645efe5ac57c168ef880b479b2. 2021-11-30[ruby/error_highlight] Ignore all syscall errorsYusuke Endoh At least, Error::ENOTSUP may be raised on some extreme environments https://github.com/ruby/error_highlight/commit/2787983ff7 2021-10-27[ruby/error_highlight] Make the formatter mechanism support RactorYusuke Endoh Now the formatter configuration is per Ractor. DefaultFormatter is used if not set. DefaultFormatter#message_for is now a class method to allow sub-Ractors to call the method. https://github.com/ruby/error_highlight/commit/9fbaa8ab7c 2021-08-20ast.c: Rename "save_script_lines" to "keep_script_lines"Yusuke Endoh ... as per ko1's preference. He is preparing to extend this feature to ISeq for his new debugger. He prefers "keep" to "save" for this wording. This API is internal and not included in any released version, so I change it in advance. 2021-07-31[ruby/error_highlight] Keep it work if paren exists after receiverMasataka Pocke Kuwabara https://github.com/ruby/error_highlight/commit/b79d679bbd 2021-07-13[ruby/error_highlight] Support a file that has no final newlineYusuke Endoh