Class: StatModule::Detail

Inherits:
JSONable show all
Defined in:
lib/detail.rb

Constant Summary

Constants inherited from JSONable

JSONable::FORMATTING_BALL, JSONable::FORMATTING_CHECKMARK, JSONable::FORMATTING_STAR, JSONable::FORMATTING_WARNING

Instance Method Summary collapse

Methods inherited from JSONable

from_json!, #to_json

Constructor Details

#initialize(body, hash = nil) ⇒ Detail

Initialize new Detail object

Params:

body

String, required

hash

Hash, can be null

Raises:



12
13
14
15
16
17
18
19
20
# File 'lib/detail.rb', line 12

def initialize(body, hash = nil)
  if hash.is_a? Hash
    super(hash)
    return
  end

  raise TypeException unless body.is_a?(String)
  @body = body
end

Instance Method Details

#bodyObject

Get body



34
35
36
# File 'lib/detail.rb', line 34

def body
  @body
end

#body=(body) ⇒ Object

Set body

Params:

body

String

Raises:



27
28
29
30
# File 'lib/detail.rb', line 27

def body=(body)
  raise TypeException unless body.is_a?(String)
  @body = body
end

#traceObject

Get trace



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

def trace
  @trace
end

#trace=(trace) ⇒ Object

Set trace

Params:

trace

array of StatModule::Location objects

Raises:



43
44
45
46
47
48
49
50
# File 'lib/detail.rb', line 43

def trace=(trace)
  raise TypeException unless trace.is_a?(Array)
  trace.each { |item|
    raise TypeException unless item.is_a?(StatModule::Location)
    raise DuplicateElementException if @trace.include?(item)
    @trace.push(item)
  }
end