[ruby/pp] Simplify range nil check
https://github.com/ruby/pp/commit/3e4b7c03b0 Co-authored-by: Nobuyoshi Nakada <nobu.nakada@gmail.com>
This commit is contained in:
parent
7b51b3c75b
commit
cd7c6c66b4
@ -488,12 +488,13 @@ end if defined?(Data.define)
|
||||
|
||||
class Range # :nodoc:
|
||||
def pretty_print(q) # :nodoc:
|
||||
both_nil = self.begin == nil && self.end == nil
|
||||
q.pp self.begin if self.begin != nil || both_nil
|
||||
begin_nil = self.begin == nil
|
||||
end_nil = self.end == nil
|
||||
q.pp self.begin if !begin_nil || end_nil
|
||||
q.breakable ''
|
||||
q.text(self.exclude_end? ? '...' : '..')
|
||||
q.breakable ''
|
||||
q.pp self.end if self.end != nil || both_nil
|
||||
q.pp self.end if !end_nil || begin_nil
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user