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.



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

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.



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

def binding
  @binding
end

#breakObject (readonly)

Returns the value of attribute break.



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

def break
  @break
end

#eventObject

Returns the value of attribute event.



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

def event
  @event
end

#fileObject (readonly)

Returns the value of attribute file.



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

def file
  @file
end

#iidObject (readonly)

Returns the value of attribute iid.



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

def iid
  @iid
end

#lineObject (readonly)

Returns the value of attribute line.



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

def line
  @line
end

#stdoutObject

Returns the value of attribute stdout.



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

def stdout
  @stdout
end

#tlsesObject (readonly)

Returns the value of attribute tlses.



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

def tlses
  @tlses
end

Instance Method Details

#to_hashObject



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

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