Class: Alphabet

Inherits:
Object
  • Object
show all
Defined in:
lib/wsugg_gem.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tocase) ⇒ Alphabet

Returns a new instance of Alphabet.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/wsugg_gem.rb', line 6

def initialize(tocase)

 @alphabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","1","2","3","4","5","6","7","8","9","0"]
 
 if tocase == :uppercase 
  write_alphabet(@alphabet, :uppercase)
 elsif tocase == :lowercase
  write_alphabet(@alphabet, :lowercase )
 end

end

Instance Attribute Details

#alphabetObject (readonly)

Returns the value of attribute alphabet.



4
5
6
# File 'lib/wsugg_gem.rb', line 4

def alphabet
  @alphabet
end

Instance Method Details

#write_alphabet(alphabet, whichcase = :lowercase) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/wsugg_gem.rb', line 18

def write_alphabet(alphabet, whichcase=:lowercase)

 @alphabet = alphabet

 if whichcase == :uppercase
  @alphabet.each{|a| puts" #{a.upcase} "}
 elsif whichcase == :lowercase
  @alphabet.each{|a| puts" #{a} "}
 end

end