diff options
| author | KOBAYASHI Shuji <[email protected]> | 2019-10-05 15:22:43 +0900 |
|---|---|---|
| committer | KOBAYASHI Shuji <[email protected]> | 2019-10-05 15:22:43 +0900 |
| commit | 1d8456fe7dc4e4b8841dd1dcd36edeac86bea89e (patch) | |
| tree | 85d2e89f00426ca451f9e5d1b6f6c4a57b941c6a | |
| parent | 1f5a7f2f4970144164232a2bc45f561de5d65c33 (diff) | |
| download | mruby-1d8456fe7dc4e4b8841dd1dcd36edeac86bea89e.tar.gz mruby-1d8456fe7dc4e4b8841dd1dcd36edeac86bea89e.zip | |
Drop initialization dependency from `mruby-print` to `mruby-sprintf`
In the old implementation, `Kernel#printf` raise error if `mruby-sprintf`
gem isn't specified before `mruby-print` gem. The new implementation
eliminates this ordering issue. This way is the same as `Kernel#printf` and
`IO#printf` in `mruby-io` gem.
| -rw-r--r-- | mrbgems/mruby-print/mrblib/print.rb | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/mrbgems/mruby-print/mrblib/print.rb b/mrbgems/mruby-print/mrblib/print.rb index 27567d858..cfe14a5e1 100644 --- a/mrbgems/mruby-print/mrblib/print.rb +++ b/mrbgems/mruby-print/mrblib/print.rb @@ -48,14 +48,8 @@ module Kernel args.__svalue end - unless Kernel.respond_to?(:sprintf) - def printf(*args) - raise NotImplementedError.new('printf not available') - end - else - def printf(*args) - __printstr__(sprintf(*args)) - nil - end + def printf(*args) + __printstr__(sprintf(*args)) + nil end end |
