Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

functional solution for method_name #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions lib/robjc/resources/asset_catalog_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,11 @@ def images
@images ||= image_names
end

def method_name(string)
components = string.split('-')
string = components.first.downcase
if components.length == 1
string
else
components.each_with_index do |s, i|
next if i == 0
string += s.capitalize
end
end
string
def method_name string
components = string.split "-"
[components.shift.downcase, *components.map(&:capitalize)].join
end

private

def image_names
Expand Down