Class: Ruined::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/ruined/ruinmain.rb

Constant Summary collapse

TLSES =
['$!', '$?', '$@', '$SAFE']

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(e, f, l, id, bnd, b, s) ⇒ Context

Returns a new instance of Context.



40
41
42
43
44
45
46
47
48
49
# File 'lib/ruined/ruinmain.rb', line 40

def initialize(e, f, l, id, bnd, b, s)
  @event = e
  @file = f
  @line = l
  @iid = id.to_s
  @break = b
  @binding = bnd
  @stdout = s
  @tlses = Hash[*(TLSES.map{|k| [k, eval(k)]}.flatten(1))]
end

Instance Attribute Details

#bindingObject (readonly)

Returns the value of attribute binding.



54
55
56
# File 'lib/ruined/ruinmain.rb', line 54

def binding
  @binding
end

#breakObject (readonly)

Returns the value of attribute break.



54
55
56
# File 'lib/ruined/ruinmain.rb', line 54

def break
  @break
end

#eventObject

Returns the value of attribute event.



55
56
57
# File 'lib/ruined/ruinmain.rb', line 55

def event
  @event
end

#fileObject (readonly)

Returns the value of attribute file.



54
55
56
# File 'lib/ruined/ruinmain.rb', line 54

def file
  @file
end

#iidObject (readonly)

Returns the value of attribute iid.



54
55
56
# File 'lib/ruined/ruinmain.rb', line 54

def iid
  @iid
end

#lineObject (readonly)

Returns the value of attribute line.



54
55
56
# File 'lib/ruined/ruinmain.rb', line 54

def line
  @line
end

#stdoutObject

Returns the value of attribute stdout.



55
56
57
# File 'lib/ruined/ruinmain.rb', line 55

def stdout
  @stdout
end

#tlsesObject (readonly)

Returns the value of attribute tlses.



54
55
56
# File 'lib/ruined/ruinmain.rb', line 54

def tlses
  @tlses
end

Instance Method Details

#to_hashObject



50
51
52
53
# File 'lib/ruined/ruinmain.rb', line 50

def to_hash
  { :event => @event, :file => @file, :line => @line, :id => @iid, :break => @break,
    :stdout => @stdout, :threads => Ruined.user_threads(self) }
end