Created
February 27, 2016 19:52
-
-
Save theonlyrao/70dee09a95869e377a59 to your computer and use it in GitHub Desktop.
before using objects...
This file contains 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
def translate(english_array) | |
@braille_arrays = [] | |
english_array.each do |word| | |
@characters = word.chars | |
end | |
binding.pry | |
if @characters[0].to_i.to_s == @characters[0] # checking to see if number | |
@braille_arrays << @etb_hash["#"] | |
@characters.each do |char| | |
@braille_arrays << @etb_hash[char] | |
end | |
if @braille_arrays[-1] != @etb_hash["."] | |
@braille_arrays << @etb_hash[" "] | |
end | |
# @braille_arrays.unshift(@etb_hash["#"]) | |
else | |
if @characters.join.capitalize == @characters.join | |
@braille_arrays << [".", ".", ".", ".", ".", "0"] | |
@characters.each do |char| | |
new_char = char.downcase | |
@braille_arrays << @etb_hash[new_char] | |
end | |
if @braille_arrays[-1] != @etb_hash["."] | |
@braille_arrays << @etb_hash[" "] | |
end | |
# @braille_arrays.unshift(@etb_hash["Capital"]) | |
else | |
@characters.each do |char| | |
@braille_arrays << @etb_hash[char] | |
end | |
if @braille_arrays[-1] != @etb_hash["."] | |
@braille_arrays << @etb_hash[" "] | |
end | |
end | |
end | |
@braille_arrays | |
# binding.pry | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment