|
93 | 93 | # o.methods = [:foo, :bar]
|
94 | 94 | # o.methods # => [:foo, :bar]
|
95 | 95 | #
|
96 |
| -# To help remedy clashes, OpenStruct uses only protected/private methods ending with `!` |
97 |
| -# and defines aliases for builtin public methods by adding a `!`: |
| 96 | +# To help remedy clashes, OpenStruct uses only protected/private methods ending with <code>!</code> |
| 97 | +# and defines aliases for builtin public methods by adding a <code>!</code>: |
98 | 98 | #
|
99 | 99 | # o = OpenStruct.new(make: 'Bentley', class: :luxury)
|
100 | 100 | # o.class # => :luxury
|
101 | 101 | # o.class! # => OpenStruct
|
102 | 102 | #
|
103 |
| -# It is recommended (but not enforced) to not use fields ending in `!`; |
| 103 | +# It is recommended (but not enforced) to not use fields ending in <code>!</code>; |
104 | 104 | # Note that a subclass' methods may not be overwritten, nor can OpenStruct's own methods
|
105 |
| -# ending with `!`. |
| 105 | +# ending with <code>!</code>. |
106 | 106 | #
|
107 | 107 | # For all these reasons, consider not using OpenStruct at all.
|
108 | 108 | #
|
@@ -279,7 +279,7 @@ def freeze
|
279 | 279 | # :call-seq:
|
280 | 280 | # ostruct[name] -> object
|
281 | 281 | #
|
282 |
| - # Returns the value of an attribute, or `nil` if there is no such attribute. |
| 282 | + # Returns the value of an attribute, or +nil+ if there is no such attribute. |
283 | 283 | #
|
284 | 284 | # require "ostruct"
|
285 | 285 | # person = OpenStruct.new("name" => "John Smith", "age" => 70)
|
@@ -452,7 +452,7 @@ def init_with(coder) # :nodoc:
|
452 | 452 | update_to_values!(h)
|
453 | 453 | end
|
454 | 454 |
|
455 |
| - # Make all public methods (builtin or our own) accessible with `!`: |
| 455 | + # Make all public methods (builtin or our own) accessible with <code>!</code>: |
456 | 456 | instance_methods.each do |method|
|
457 | 457 | new_name = "#{method}!"
|
458 | 458 | alias_method new_name, method
|
|
0 commit comments