Top Level Namespace

Defined Under Namespace

Modules: EditorLearner Classes: ConvertHashSyntaxTest, ConvertLengthTest, FizzBuzzTest, Gate, GateTest, RgbTest, Ticket, User

Instance Method Summary collapse

Instance Method Details

#barObject



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

def bar
  'BAR'
end

#charge(age) ⇒ Object



1
2
3
4
5
6
7
8
9
10
11
12
# File 'lib/random_check_question/10.rb', line 1

def charge(age)
  case age
  when 0..5
    0
  when 6..12
    300
  when 13..18
    600
  else
    1000
  end
end

#convert_hash_syntax(old_syntax) ⇒ Object



16
17
18
# File 'lib/sequential_check_question/ruby_5/1.rb', line 16

def convert_hash_syntax(old_syntax)
  old_syntax
end

#convert_length(length, from: :m, to: :m) ⇒ Object



9
10
11
# File 'lib/sequential_check_question/ruby_4/1.rb', line 9

def convert_length(length, unit_from, unit_to)
  39.37
end

#fizz_buzz(n) ⇒ Object



1
2
3
# File 'lib/question/ruby_1/1.rb', line 1

def fizz_buzz(n)
  n.to_s
end

#foo(time = Time.now, message = bar) ⇒ Object



1
2
3
# File 'lib/random_check_question/3.rb', line 1

def foo(time = Time.now, message = bar)
  puts "time: #{time}, message: #{message}"
end

#full_name(user) ⇒ Object



16
17
18
# File 'lib/random_check_question/14.rb', line 16

def full_name(user)
  "#{user.first_name} #{user.last_name}"
end

#greeting(country) ⇒ Object



1
2
3
4
5
6
7
# File 'lib/random_check_question/2.rb', line 1

def greeting(country)
  if country == 'japan'
    'こんにちは'
  else
    'hello'
  end
end

#liquid?(temperature) ⇒ Boolean

Returns:

  • (Boolean)


1
2
3
# File 'lib/random_check_question/9.rb', line 1

def liquid?(temperature)
  0 <= temperature && temperature < 100
end

#m(d) ⇒ Object



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

def m(d)
  d.object_id
end

#to_hex(r, g, b) ⇒ Object



9
10
11
# File 'lib/sequential_check_question/ruby_3/1.rb', line 9

def to_hex(r, g, b)
  '#000000'
end