Enable rubocop Performance/HashEachMethods cop & fix issues
This commit is contained in:
@@ -73,6 +73,9 @@ Performance/FixedSize:
|
|||||||
Performance/FlatMap:
|
Performance/FlatMap:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Performance/HashEachMethods:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
Performance/LstripRstrip:
|
Performance/LstripRstrip:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ module Ahoy
|
|||||||
# chart
|
# chart
|
||||||
def add(name, collection)
|
def add(name, collection)
|
||||||
collections.push data: collection, name: name
|
collections.push data: collection, name: name
|
||||||
collection.each{ |k, v| add_key k }
|
collection.each_key{ |key| add_key key }
|
||||||
end
|
end
|
||||||
|
|
||||||
def build
|
def build
|
||||||
data = { x: [] }
|
data = { x: [] }
|
||||||
keys.each do |k|
|
shared_keys.each do |k|
|
||||||
# Add the key with a valid date format
|
# Add the key with a valid date format
|
||||||
data[:x].push k.strftime("%Y-%m-%d")
|
data[:x].push k.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
@@ -36,12 +36,12 @@ module Ahoy
|
|||||||
@collections ||= []
|
@collections ||= []
|
||||||
end
|
end
|
||||||
|
|
||||||
def keys
|
def shared_keys
|
||||||
@keys ||= []
|
@shared_keys ||= []
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_key(key)
|
def add_key(key)
|
||||||
keys.push(key) unless keys.include? key
|
shared_keys.push(key) unless shared_keys.include? key
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user