Skip to content

Commit dbf541a

Browse files
committed
removed some unnecessary calls to to_s in attributes proxy
1 parent 0ca2866 commit dbf541a

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/optimizations/columns/attributes_proxy.rb

+6-7
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def keys
5252
# Let #has_key? consider defined columns
5353
#
5454
def has_key?(attr_name)
55-
@klass.columns_hash.has_key?(attr_name.to_s)
55+
@klass.columns_hash.has_key?(attr_name)
5656
end
5757

5858
alias_method :include?, :has_key?
@@ -62,11 +62,10 @@ def has_key?(attr_name)
6262
# Lazily augment and load missing attributes
6363
#
6464
def [](attr_name)
65-
attr_s = attr_name.to_s
66-
if interesting_for_scrooge?( attr_s )
67-
augment_callsite!( attr_s )
65+
if interesting_for_scrooge?( attr_name )
66+
augment_callsite!( attr_name )
6867
fetch_remaining
69-
@scrooge_columns << attr_s
68+
@scrooge_columns << attr_name
7069
end
7170
super
7271
end
@@ -77,7 +76,7 @@ def fetch(*args, &block)
7776
end
7877

7978
def []=(attr_name, value)
80-
@scrooge_columns << attr_name.to_s
79+
@scrooge_columns << attr_name
8180
super
8281
end
8382

@@ -111,7 +110,7 @@ def update(hash)
111110

112111
def fetch_remaining
113112
unless @fully_fetched
114-
columns_to_fetch = keys - @scrooge_columns.to_a
113+
columns_to_fetch = @klass.column_names - @scrooge_columns.to_a
115114
unless columns_to_fetch.empty?
116115
fetch_remaining!( columns_to_fetch )
117116
end

0 commit comments

Comments
 (0)