Method: Olib.wrap

Defined in:
lib/Olib/core/utils.rb

.wrap(action = nil) ⇒ Object



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/Olib/core/utils.rb', line 144

def Olib.wrap(action = nil)
  
  begin
    Olib.timeout(3) {
      put action if action
      while (line=get)
        next if Dictionary.ignorable?(line)
        # attempt at removing PC action that turned out to be more harmful than good
        # next if not GameObj.pcs.nil? and line =~ /#{GameObj.pcs.join('|')}/
        yield line
      end
    }

  rescue Olib::Errors::TimedOut
    Olib.debug "timeout... "
    # Silent
  rescue Olib::Errors::Mundane => e

  rescue Olib::Errors::Prempt => e
    
  end
  
end