Class: Object

Inherits:
BasicObject
Defined in:
lib/tanraku.rb

Overview

Can add it to the object method chain

Instance Method Summary collapse

Instance Method Details

#tanrakuObject



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

def tanraku
  m2 = Mutex.new

  begin
    m2.lock
    raise Object
  rescue StandardError => e
    puts "#{e.backtrace}".to_s
    print 'Tanraku Method Exception '
  ensure
    puts '--> next class search...'
    m2.unlock
  end
end

#tanraku_executeObject



35
36
37
38
39
40
41
42
43
# File 'lib/tanraku.rb', line 35

def tanraku_execute
  raise Object
rescue StandardError => e
  puts "#{e.backtrace}".to_s
  puts "#{e.class} : #{e.message}".to_s
ensure
  puts '--> Tanraku_Execute Method Exception'
  exit!
end

#tanraku_exitObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/tanraku.rb', line 20

def tanraku_exit
  m2 = Mutex.new

  begin
    m2.lock
    raise Object
  rescue StandardError => e
    puts "#{e.backtrace}".to_s
  ensure
    puts '--> Tanraku_Exit Method Exception'
    m2.unlock
    exit!
  end
end

#tanraku_logObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/tanraku.rb', line 45

def tanraku_log
  m2 = Mutex.new

  begin
    m2.lock
    Dir.mkdir('log', 0o666) unless FileTest.exist?('log')
    File.open('log/logs.txt', 'a:utf-8') do |log_create|
      myself = Exception.new('My Exception is raise message.')
      log_create.puts myself.message
      raise Object
    end
  rescue StandardError => e
    File.open('log/logs.txt', 'a:utf-8') do |log_write|
      log_write.puts "#{e.backtrace}".to_s
      log_write.puts "#{e.class} : #{e.message}".to_s
    end
  ensure
    puts 'Tanraku_log write log/logs.txt.'.to_s
    m2.unlock
    exit!
  end
end