Skip to content

Commit

Permalink
Avoid unnecessary object allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
shioyama committed Jan 19, 2018
1 parent 927cdbe commit 8a7b2d4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/mobility/backends/hash_valued.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ module HashValued
# @!group Backend Accessors
#
# @!macro backend_reader
def read(locale, _ = {})
def read(locale, _options = nil)
translations[locale]
end

# @!macro backend_writer
def write(locale, value, _ = {})
def write(locale, value, _options = nil)
translations[locale] = value
end
# @!endgroup
Expand Down
4 changes: 2 additions & 2 deletions lib/mobility/backends/null.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ class Null

# @!group Backend Accessors
# @return [NilClass]
def read(_, _ = {}); end
def read(_locale, _options = nil); end

# @return [NilClass]
def write(_, _, _ = {}); end
def write(_locale, _value, _options = nil); end
# @!endgroup

# @!group Backend Configuration
Expand Down
4 changes: 2 additions & 2 deletions lib/mobility/backends/sequel/column.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ class Sequel::Column

# @!group Backend Accessors
# @!macro backend_reader
def read(locale, _ = {})
def read(locale, _options = nil)
column = column(locale)
model[column] if model.columns.include?(column)
end

# @!group Backend Accessors
# @!macro backend_writer
def write(locale, value, _ = {})
def write(locale, value, _options = nil)
column = column(locale)
model[column] = value if model.columns.include?(column)
end
Expand Down

0 comments on commit 8a7b2d4

Please sign in to comment.