Class: A1447llMiniTest::MyClass

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

Instance Method Summary collapse

Instance Method Details

#check_number?(value) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/a1447ll_mini_test.rb', line 9

def check_number? (value)
  (1000..9999).include? value and value%2 == 0
end

#divide(a, b) ⇒ Object



17
18
19
# File 'lib/a1447ll_mini_test.rb', line 17

def divide (a, b)
  a / b
end

#enough_length?(string) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/a1447ll_mini_test.rb', line 13

def enough_length? (string)
  (3..8).include? string.length
end

#fizz_buzz(value) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/a1447ll_mini_test.rb', line 21

def fizz_buzz  (value)
  if value%15 == 0 
    "FizzBuzz"
  elsif value%3 == 0
    "Fizz"
  elsif value%5 == 0
    "Buzz"
  end
end

#hello(string) ⇒ Object



31
32
33
34
# File 'lib/a1447ll_mini_test.rb', line 31

def hello (string)
  name = string.split.map{|word| word.capitalize}.join(' ')
  "Hello, " + name + "!"
end

#odd?(value) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/a1447ll_mini_test.rb', line 5

def odd? (value)
  value%2 == 1
end