Skip to content

Commit

Permalink
Rename methods
Browse files Browse the repository at this point in the history
  • Loading branch information
ursm committed Jul 12, 2024
1 parent 7f2d314 commit b30490e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions lib/fetch/form_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ def self.build(enumerable)

private

def transform_key(key)
def to_key(key)
key.to_s
end

def transform_value(value)
def to_value(value)
File === value ? value : value.to_s
end
end
Expand Down
14 changes: 7 additions & 7 deletions lib/fetch/multi_map.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ def initialize
attr_reader :entries

def append(key, value)
@entries.push [transform_key(key), transform_value(value)]
@entries.push [to_key(key), to_value(value)]
end

def delete(key)
@entries.reject! {|k,| k == transform_key(key) }
@entries.reject! {|k,| k == to_key(key) }
end

def get(key)
@entries.assoc(transform_key(key))&.last
@entries.assoc(to_key(key))&.last
end

def get_all(key)
@entries.select {|k,| k == transform_key(key) }.map(&:last)
@entries.select {|k,| k == to_key(key) }.map(&:last)
end

def has(key)
@entries.any? {|k,| k == transform_key(key) }
@entries.any? {|k,| k == to_key(key) }
end

def keys
Expand All @@ -47,11 +47,11 @@ def each(&)

private

def transform_key(key)
def to_key(key)
raise NotImplementedError
end

def transform_value(value)
def to_value(value)
raise NotImplementedError
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/fetch/url_search_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ def to_s

private

def transform_key(key)
def to_key(key)
key.to_s
end

def transform_value(value)
def to_value(value)
value.to_s
end
end
Expand Down
4 changes: 2 additions & 2 deletions sig/fetch/multi_map.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module Fetch

private

def transform_key: (KIN) -> KOUT
def transform_value: (VIN) -> VOUT
def to_key: (KIN) -> KOUT
def to_value: (VIN) -> VOUT
end
end

0 comments on commit b30490e

Please sign in to comment.