diff options
author | Abinoam P. Marques Jr <abinoam@gmail.com> | 2017-09-25 14:51:49 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-25 14:51:49 -0300 |
commit | 73bd6a13a479cce042ed702a4154e15d169efb3f (patch) | |
tree | e2d93d36e2d4ea7c4c243bce29b84ec014001e5e /lib/highline/simulate.rb | |
parent | 66b8ece6560879a4e7d34dd6bd0cf20d48f3b3a7 (diff) | |
parent | b48f09dc4828b6eab3588862d53a445197f6ee26 (diff) | |
download | highline-73bd6a13a479cce042ed702a4154e15d169efb3f.tar.gz |
Merge pull request #215 from JEG2/rubocopv2.0.0.pre.develop.11
Apply Rubocop stylistic suggestions
Diffstat (limited to 'lib/highline/simulate.rb')
-rw-r--r-- | lib/highline/simulate.rb | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/highline/simulate.rb b/lib/highline/simulate.rb index c1ee6df..f92eaa3 100644 --- a/lib/highline/simulate.rb +++ b/lib/highline/simulate.rb @@ -10,12 +10,9 @@ # # adapted from https://gist.github.com/194554 - class HighLine - # Simulates Highline input for use in tests. class Simulate - # Creates a simulator with an array of Strings as a script # @param strings [Array<String>] preloaded string to be used # as input buffer when simulating. @@ -28,14 +25,15 @@ class HighLine @strings.shift end - # Simulate StringIO#getbyte by shifting a single character off of the next line of the script + # Simulate StringIO#getbyte by shifting a single character off of + # the next line of the script def getbyte line = gets - if line.length > 0 - char = line.slice! 0 - @strings.unshift line - char - end + return if line.empty? + + char = line.slice! 0 + @strings.unshift line + char end # The simulator handles its own EOF |