Class: Julianus::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/julianus/report.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body) ⇒ Report

new report with no claims



9
10
11
12
# File 'lib/julianus/report.rb', line 9

def initialize body
	@claims = []
	@body = body
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



6
7
8
# File 'lib/julianus/report.rb', line 6

def body
  @body
end

Instance Method Details

#add_claim(c) ⇒ Object

adds new claim



26
27
28
29
# File 'lib/julianus/report.rb', line 26

def add_claim c
	claim = Claim.new(c[:item])
	@claims << claim
end

#claimsObject

returns all claims



21
22
23
# File 'lib/julianus/report.rb', line 21

def claims
	@claims
end

#has_claims?Boolean

returns true or false according to if claim has items or false

Returns:

  • (Boolean)


16
17
18
# File 'lib/julianus/report.rb', line 16

def has_claims?
	@claims.length > 0
end

#to_sObject



31
32
33
34
35
36
37
# File 'lib/julianus/report.rb', line 31

def to_s
	result = []
	@claims.each do |claim|
		result << claim
	end
	result
end