Module: Short_Circuit

Defined in:
lib/tanraku.rb

Overview

Can be used as a function

Class Method Summary collapse

Class Method Details

.tanrakuObject



77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/tanraku.rb', line 77

def tanraku
  m2 = Mutex.new

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

.tanraku_executeObject



107
108
109
110
111
112
113
114
115
# File 'lib/tanraku.rb', line 107

def tanraku_execute
  raise
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



92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/tanraku.rb', line 92

def tanraku_exit
  m2 = Mutex.new

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

.tanraku_logObject



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/tanraku.rb', line 117

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
    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