Skip to content

Instantly share code, notes, and snippets.

@ybur-yug
Last active November 14, 2016 13:05
Show Gist options
  • Save ybur-yug/06dea775ad36e701fc56ece4820156c0 to your computer and use it in GitHub Desktop.
Save ybur-yug/06dea775ad36e701fc56ece4820156c0 to your computer and use it in GitHub Desktop.
module Pangram do
def self.is?(string)
string
.downcase
.split("")
.select { |character| in_alphabet? character }
.uniq
.sort == alphabet
end
def alphabet
('a'..'z').to_a
end
def in_alphabet character
alphabet.include? character
end
end
# Usage:
# Pangram.is("hey hey abcDEfg ihjklmonpqrstuvqxyz you you")
# => true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment