Last active
December 14, 2018 03:23
-
-
Save dinjas/adde8ed92374311b5dbb to your computer and use it in GitHub Desktop.
Why dinjas?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: | |
# >> Namer.new("Jason Dinsmore").computer_name | |
# => "dinjas" | |
require 'concord' | |
class Namer | |
include Concord.new(:full_name) | |
def computer_name | |
names | |
.map(&method(:translate)) | |
.reverse | |
.join | |
end | |
def names | |
full_name.split | |
end | |
def translate(str) | |
str.downcase.slice(0, 3) | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment