Replace #=>
with # =>
[ci skip]
@rafaelfranca suggested in f7c7bcd9 that code examples should display
the result after `# =>` and not after `#=>`.
This commit replaces *all* the occurrences of `#=>` in the code documentation
(mostly added by me 😭) with the suggested `# =>`.
This commit is contained in:
parent
78789b7acd
commit
23c8f6918d
@ -4,7 +4,7 @@ class Hash
|
||||
# h1 = { a: true, b: { c: [1, 2, 3] } }
|
||||
# h2 = { a: false, b: { x: [3, 4, 5] } }
|
||||
#
|
||||
# h1.deep_merge(h2) #=> { a: false, b: { c: [1, 2, 3], x: [3, 4, 5] } }
|
||||
# h1.deep_merge(h2) # => { a: false, b: { c: [1, 2, 3], x: [3, 4, 5] } }
|
||||
#
|
||||
# Like with Hash#merge in the standard library, a block can be provided
|
||||
# to merge values:
|
||||
|
@ -203,7 +203,7 @@ def #{sym}=(obj)
|
||||
# include HairColors
|
||||
# end
|
||||
#
|
||||
# Person.class_variable_get("@@hair_colors") #=> [:brown, :black, :blonde, :red]
|
||||
# Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red]
|
||||
def mattr_accessor(*syms, &blk)
|
||||
mattr_reader(*syms, &blk)
|
||||
mattr_writer(*syms, &blk)
|
||||
|
@ -8,7 +8,7 @@ class Numeric
|
||||
|
||||
# Enables the use of byte calculations and declarations, like 45.bytes + 2.6.megabytes
|
||||
#
|
||||
# 2.bytes #=> 2
|
||||
# 2.bytes # => 2
|
||||
def bytes
|
||||
self
|
||||
end
|
||||
@ -16,7 +16,7 @@ def bytes
|
||||
|
||||
# Returns the number of bytes equivalent to the kilobytes provided.
|
||||
#
|
||||
# 2.kilobytes #=> 2048
|
||||
# 2.kilobytes # => 2048
|
||||
def kilobytes
|
||||
self * KILOBYTE
|
||||
end
|
||||
@ -24,7 +24,7 @@ def kilobytes
|
||||
|
||||
# Returns the number of bytes equivalent to the megabytes provided.
|
||||
#
|
||||
# 2.megabytes #=> 2_097_152
|
||||
# 2.megabytes # => 2_097_152
|
||||
def megabytes
|
||||
self * MEGABYTE
|
||||
end
|
||||
@ -32,7 +32,7 @@ def megabytes
|
||||
|
||||
# Returns the number of bytes equivalent to the gigabytes provided.
|
||||
#
|
||||
# 2.gigabytes #=> 2_147_483_648
|
||||
# 2.gigabytes # => 2_147_483_648
|
||||
def gigabytes
|
||||
self * GIGABYTE
|
||||
end
|
||||
@ -40,7 +40,7 @@ def gigabytes
|
||||
|
||||
# Returns the number of bytes equivalent to the terabytes provided.
|
||||
#
|
||||
# 2.terabytes #=> 2_199_023_255_552
|
||||
# 2.terabytes # => 2_199_023_255_552
|
||||
def terabytes
|
||||
self * TERABYTE
|
||||
end
|
||||
@ -48,7 +48,7 @@ def terabytes
|
||||
|
||||
# Returns the number of bytes equivalent to the petabytes provided.
|
||||
#
|
||||
# 2.petabytes #=> 2_251_799_813_685_248
|
||||
# 2.petabytes # => 2_251_799_813_685_248
|
||||
def petabytes
|
||||
self * PETABYTE
|
||||
end
|
||||
@ -56,7 +56,7 @@ def petabytes
|
||||
|
||||
# Returns the number of bytes equivalent to the exabytes provided.
|
||||
#
|
||||
# 2.exabytes #=> 2_305_843_009_213_693_952
|
||||
# 2.exabytes # => 2_305_843_009_213_693_952
|
||||
def exabytes
|
||||
self * EXABYTE
|
||||
end
|
||||
|
@ -21,11 +21,11 @@ class Object
|
||||
#
|
||||
# +try+ will also return +nil+ if the receiver does not respond to the method:
|
||||
#
|
||||
# @person.try(:non_existing_method) #=> nil
|
||||
# @person.try(:non_existing_method) # => nil
|
||||
#
|
||||
# instead of
|
||||
#
|
||||
# @person.non_existing_method if @person.respond_to?(:non_existing_method) #=> nil
|
||||
# @person.non_existing_method if @person.respond_to?(:non_existing_method) # => nil
|
||||
#
|
||||
# +try+ returns +nil+ when called on +nil+ regardless of whether it responds
|
||||
# to the method:
|
||||
|
@ -67,8 +67,8 @@ def thread_variable?(key)
|
||||
#
|
||||
# me = Thread.current
|
||||
# me.freeze
|
||||
# me.thread_variable_set(:oliver, "a") #=> RuntimeError: can't modify frozen thread locals
|
||||
# me[:oliver] = "a" #=> RuntimeError: can't modify frozen thread locals
|
||||
# me.thread_variable_set(:oliver, "a") # => RuntimeError: can't modify frozen thread locals
|
||||
# me[:oliver] = "a" # => RuntimeError: can't modify frozen thread locals
|
||||
def freeze
|
||||
_locals.freeze
|
||||
super
|
||||
|
@ -55,12 +55,12 @@ def use_zone(time_zone)
|
||||
# Accepts the time zone in any format supported by <tt>Time.zone=</tt>.
|
||||
# Raises an ArgumentError for invalid time zones.
|
||||
#
|
||||
# Time.find_zone! "America/New_York" #=> #<ActiveSupport::TimeZone @name="America/New_York" ...>
|
||||
# Time.find_zone! "EST" #=> #<ActiveSupport::TimeZone @name="EST" ...>
|
||||
# Time.find_zone! -5.hours #=> #<ActiveSupport::TimeZone @name="Bogota" ...>
|
||||
# Time.find_zone! nil #=> nil
|
||||
# Time.find_zone! false #=> false
|
||||
# Time.find_zone! "NOT-A-TIMEZONE" #=> ArgumentError: Invalid Timezone: NOT-A-TIMEZONE
|
||||
# Time.find_zone! "America/New_York" # => #<ActiveSupport::TimeZone @name="America/New_York" ...>
|
||||
# Time.find_zone! "EST" # => #<ActiveSupport::TimeZone @name="EST" ...>
|
||||
# Time.find_zone! -5.hours # => #<ActiveSupport::TimeZone @name="Bogota" ...>
|
||||
# Time.find_zone! nil # => nil
|
||||
# Time.find_zone! false # => false
|
||||
# Time.find_zone! "NOT-A-TIMEZONE" # => ArgumentError: Invalid Timezone: NOT-A-TIMEZONE
|
||||
def find_zone!(time_zone)
|
||||
if !time_zone || time_zone.is_a?(ActiveSupport::TimeZone)
|
||||
time_zone
|
||||
@ -85,8 +85,8 @@ def find_zone!(time_zone)
|
||||
# Accepts the time zone in any format supported by <tt>Time.zone=</tt>.
|
||||
# Returns +nil+ for invalid time zones.
|
||||
#
|
||||
# Time.find_zone "America/New_York" #=> #<ActiveSupport::TimeZone @name="America/New_York" ...>
|
||||
# Time.find_zone "NOT-A-TIMEZONE" #=> nil
|
||||
# Time.find_zone "America/New_York" # => #<ActiveSupport::TimeZone @name="America/New_York" ...>
|
||||
# Time.find_zone "NOT-A-TIMEZONE" # => nil
|
||||
def find_zone(time_zone)
|
||||
find_zone!(time_zone) rescue nil
|
||||
end
|
||||
|
@ -68,7 +68,7 @@ def initialize(name, start, ending, transaction_id, payload)
|
||||
# sleep 1
|
||||
# end
|
||||
#
|
||||
# @event.duration #=> 1000.138
|
||||
# @event.duration # => 1000.138
|
||||
def duration
|
||||
@duration ||= 1000.0 * (self.end - time)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user