summaryrefslogtreecommitdiffhomepage
path: root/mrblib
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2015-05-29 17:01:44 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2015-05-29 17:01:52 +0900
commitb05d736b49a6d3a99b7f75c74ffd9b6613c453d3 (patch)
treecae1cfe223f130dffe344cc533e3873f52802aa8 /mrblib
parent13a2cc3e5d27c33db7f4cf06ece4c44a79c79c53 (diff)
downloadmruby-b05d736b49a6d3a99b7f75c74ffd9b6613c453d3.tar.gz
mruby-b05d736b49a6d3a99b7f75c74ffd9b6613c453d3.zip
update mrblib/*.rb files to conform (some of) Rubocop checks
Diffstat (limited to 'mrblib')
-rw-r--r--mrblib/array.rb4
-rw-r--r--mrblib/hash.rb4
-rw-r--r--mrblib/kernel.rb2
-rw-r--r--mrblib/numeric.rb8
-rw-r--r--mrblib/range.rb2
-rw-r--r--mrblib/string.rb6
6 files changed, 13 insertions, 13 deletions
diff --git a/mrblib/array.rb b/mrblib/array.rb
index bd8d5930f..83a42c62d 100644
--- a/mrblib/array.rb
+++ b/mrblib/array.rb
@@ -34,7 +34,7 @@ class Array
return to_enum :each_index unless block_given?
idx = 0
- while(idx < length)
+ while idx < length
block.call(idx)
idx += 1
end
@@ -75,7 +75,7 @@ class Array
self[size - 1] = nil # allocate
idx = 0
- while(idx < size)
+ while idx < size
self[idx] = (block)? block.call(idx): obj
idx += 1
end
diff --git a/mrblib/hash.rb b/mrblib/hash.rb
index e7c51fb1f..cb52c1ffe 100644
--- a/mrblib/hash.rb
+++ b/mrblib/hash.rb
@@ -10,7 +10,7 @@ class Hash
# hash.
#
# ISO 15.2.13.4.1
- def == (hash)
+ def ==(hash)
return true if self.equal?(hash)
begin
hash = hash.to_hash
@@ -54,7 +54,7 @@ class Hash
#
# ISO 15.2.13.4.8
def delete(key, &block)
- if block && ! self.has_key?(key)
+ if block && !self.has_key?(key)
block.call(key)
else
self.__delete(key)
diff --git a/mrblib/kernel.rb b/mrblib/kernel.rb
index 8c9b122f2..38af3b310 100644
--- a/mrblib/kernel.rb
+++ b/mrblib/kernel.rb
@@ -27,7 +27,7 @@ module Kernel
def loop(&block)
return to_enum :loop unless block
- while(true)
+ while true
yield
end
rescue StopIteration
diff --git a/mrblib/numeric.rb b/mrblib/numeric.rb
index 1f44a2c81..cf608b04b 100644
--- a/mrblib/numeric.rb
+++ b/mrblib/numeric.rb
@@ -48,7 +48,7 @@ module Integral
return to_enum(:downto, num) unless block_given?
i = self.to_i
- while(i >= num)
+ while i >= num
block.call(i)
i -= 1
end
@@ -89,7 +89,7 @@ module Integral
return to_enum(:upto, num) unless block_given?
i = self.to_i
- while(i <= num)
+ while i <= num
block.call(i)
i += 1
end
@@ -106,12 +106,12 @@ module Integral
i = if num.kind_of? Float then self.to_f else self end
if step > 0
- while(i <= num)
+ while i <= num
block.call(i)
i += step
end
else
- while(i >= num)
+ while i >= num
block.call(i)
i += step
end
diff --git a/mrblib/range.rb b/mrblib/range.rb
index 1ec9ac508..64fa0cb6c 100644
--- a/mrblib/range.rb
+++ b/mrblib/range.rb
@@ -32,7 +32,7 @@ class Range
return self if (val <=> last) > 0
- while((val <=> last) < 0)
+ while (val <=> last) < 0
block.call(val)
val = val.succ
end
diff --git a/mrblib/string.rb b/mrblib/string.rb
index 1d9ea9e6a..90aad5d32 100644
--- a/mrblib/string.rb
+++ b/mrblib/string.rb
@@ -12,7 +12,7 @@ class String
def each_line(&block)
# expect that str.index accepts an Integer for 1st argument as a byte data
offset = 0
- while(pos = self.index(0x0a, offset))
+ while pos = self.index(0x0a, offset)
block.call(self[offset, pos + 1 - offset])
offset = pos + 1
end
@@ -106,7 +106,7 @@ class String
# +self+.
def each_char(&block)
pos = 0
- while(pos < self.size)
+ while pos < self.size
block.call(self[pos])
pos += 1
end
@@ -118,7 +118,7 @@ class String
def each_byte(&block)
bytes = self.bytes
pos = 0
- while(pos < bytes.size)
+ while pos < bytes.size
block.call(bytes[pos])
pos += 1
end