rubyでメソッドの引数にデフォルト式を渡したとき、その引数が省略されたかどうか知る一番よい方法はなんだろう。
ふつうに
class TheClass
def the_method(a = nil)
if a.nil?
do_something
else| % zundoko-kiyoshi in postscript | |
| /Palatino-Italic findfont 40 scalefont setfont | |
| /height 50 def | |
| clippath pathbbox /top exch def pop pop pop newpath | |
| 10 top moveto | |
| /zd { | |
| rand 2 mod 0 eq |
| @page :first { | |
| margin: 0; | |
| } |
| rm -rf ~/Library/Application\ Support/Slack/ | |
| rm -rf ~/Library/Containers/com.tinyspeck.slackmacgap/ | |
| rm -rf ~/Library/Preferences/com.tinyspeck.slackmacgap.plist | |
| rm -rf ~/Library/Saved\ Application\ State/com.tinyspeck.slackmacgap.savedState | |
| rm ~/Library/Safari/LocalStorage/*slack* |
| <?xml version="1.0" encoding="UTF-8" ?> | |
| <!DOCTYPE html> | |
| <html xmlns="http://www.w3.org/1999/xhtml"> | |
| <head> | |
| <title>test</title> | |
| <style type="text/css"> | |
| body { | |
| margin: 1em; | |
| writing-mode: vertical-rl; | |
| -webkit-writing-mode: vertical-rl; |
rubyでメソッドの引数にデフォルト式を渡したとき、その引数が省略されたかどうか知る一番よい方法はなんだろう。
ふつうに
class TheClass
def the_method(a = nil)
if a.nil?
do_something
else| --- | |
| title: サンプル文書 | |
| generator: htmlbook | |
| --- | |
| #(titlepage) サンプル文書 | |
| by Satoshi Kojima | |
| #(preface) 前書き |
| start | |
| = Document | |
| Document | |
| = l:TheLine LF d:Document { d.unshift(l); return d } | |
| / l:TheLine { return [l]; } | |
| TheLine = DocumentLine / NotAllowedLine | |
| NotAllowedLine = "not allowed" LF { return "not allowed but here."; } | |
| DocumentLine |
| start | |
| = Document | |
| Document | |
| = EmptyLine* blocks:Block* { return blocks.join("\n"); } | |
| Block | |
| = b:(ExplicitBlock / ParagraphGroup) EmptyLine* | |
| { return b; } | |
| ExplicitBlockHead |
| # Markdown-ish heading with explicit setion boundary | |
| --- | |
| lang: ja | |
| title: test title | |
| stylesheets: css/normalize.css, css/main.css | |
| --- | |
| =: this is the first heading |