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

Returns a new instance of Detail.



6
7
8
9
10
11
12
13
14
15
# File 'lib/detail.rb', line 6

def initialize(body, hash = nil)
  @trace = []

  if hash.is_a? Hash
    super(hash)
    return
  end

  @body = body
end

Instance Method Details

#bodyObject



22
23
24
# File 'lib/detail.rb', line 22

def body
  @body
end

#body=(body) ⇒ Object

Raises:



17
18
19
20
# File 'lib/detail.rb', line 17

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

#traceObject



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

def trace
  @trace
end

#trace=(trace) ⇒ Object

Raises:



26
27
28
29
30
31
32
33
# File 'lib/detail.rb', line 26

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