Module: PositiveKernelSupport

Defined in:
lib/positive_kernel_support.rb,
lib/positive_kernel_support/version.rb

Constant Summary collapse

VERSION =
::File.open( "#{ ::File.dirname( __FILE__ ) }/../../.current_version" , "r:utf-8" ).read.chomp

コマンドツールへの情報の表示 collapse

Instance Method Details

#put_empty_row(n = 1) ⇒ nil

空行を表示する.

Parameters:

  • n (Integer (natural)) (defaults to: 1)

    表示する空行の数

Returns:

  • (nil)

Raises:

  • (IndexError)

    n が自然数でない場合に発生するエラー



12
13
14
15
16
17
18
# File 'lib/positive_kernel_support.rb', line 12

def put_empty_row(n=1)
  raise unless n.natural_number?
  n.times do
    puts( "" )
  end
  return nil
end

#put_message(str) ⇒ nil

str を表示した後,空行を1行追加する.

Parameters:

  • str (String, Numeric, etc.)

    表示する内容

Returns:

  • (nil)


23
24
25
26
27
# File 'lib/positive_kernel_support.rb', line 23

def put_message( str )
  puts( str )
  put_empty_row
  return nil
end

#put_separation_line(n = 128, char: "=") ⇒ nil

区切り線(区切りの記号は = )を表示する

Parameters:

  • n (Integer (natural)) (defaults to: 128)

    表示する区切り記号の数

Returns:

  • (nil)

Raises:

  • (IndexError)

    n が自然数でない場合に発生するエラー



33
34
35
36
37
38
# File 'lib/positive_kernel_support.rb', line 33

def put_separation_line( n = 128 , char: "=")
  raise "Error: The variable should be an integer."unless n.natural_number?
  raise unless char.string?
  put_message( char * n )
  return nil
end