File tree 2 files changed +48
-1
lines changed
2 files changed +48
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
10
10
11
11
For a steady stream of TILs, [ sign up for my newsletter] ( https://crafty-builder-6996.ck.page/e169c61186 ) .
12
12
13
- _ 1436 TILs and counting..._
13
+ _ 1437 TILs and counting..._
14
14
15
15
---
16
16
@@ -1180,6 +1180,7 @@ _1436 TILs and counting..._
1180
1180
- [ Map With Index Over An Array] ( ruby/map-with-index-over-an-array.md )
1181
1181
- [ Mock Method Chain Calls With RSpec] ( ruby/mock-method-chain-calls-with-rspec.md )
1182
1182
- [ Mocking Requests With Partial URIs Using Regex] ( ruby/mocking-requests-with-partial-uris-using-regex.md )
1183
+ - [ Multi-Line Comments] ( ruby/multi-line-comments.md )
1183
1184
- [ Named Regex Captures Are Assigned To Variables] ( ruby/named-regex-captures-are-assigned-to-variables.md )
1184
1185
- [ Navigate Back In The Browser With Capybara] ( ruby/navigate-back-in-the-browser-with-capybara.md )
1185
1186
- [ Next And Previous Floats] ( ruby/next-and-previous-floats.md )
Original file line number Diff line number Diff line change
1
+ # Multi-Line Comments
2
+
3
+ Ruby has an obscure syntax for creating multi-line comments.
4
+
5
+ In many languages, there is a multi-line comment syntax that looks something
6
+ like this:
7
+
8
+ ``` javascript
9
+ /*
10
+ * multi-line comment in javascript
11
+ */
12
+ ```
13
+
14
+ This gets used often in those languages.
15
+
16
+ In Ruby, the multi-line comment syntax is not something we see very often. It
17
+ is a departure from the single-line comment syntax and it also requires no
18
+ indentation.
19
+
20
+ ``` ruby
21
+ RSpec .configure do |config |
22
+ config.order = :random
23
+
24
+ # The settings below are suggested to provide a good initial experience
25
+ # with RSpec, but feel free to customize to your heart's content.
26
+ =begin
27
+ # These two settings work together to allow you to limit a spec run
28
+ # to individual examples or groups you care about by tagging them with
29
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
30
+ # get run.
31
+ config.filter_run :focus
32
+ config.run_all_when_everything_filtered = true
33
+
34
+ # ...
35
+
36
+ =end
37
+ end
38
+ ```
39
+
40
+ Using the ` =begin ` and ` =end ` syntax (no indentation), we make everything
41
+ inbetween into a comment.
42
+
43
+ Though we don't see this too often, I did pull this example directly from the
44
+ ` spec_helper.rb ` file that RSpec generates.
45
+
46
+ [ source] ( https://docs.ruby-lang.org/en/master/syntax/comments_rdoc.html )
You can’t perform that action at this time.
0 commit comments