Class: Julianus::Claim

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

Instance Method Summary collapse

Constructor Details

#initialize(items) ⇒ Claim

new claim with on items



6
7
8
9
10
11
12
13
# File 'lib/julianus/claim.rb', line 6

def initialize items
	@items = []
	items = [] << items unless items.is_a?(Array)
	items.each do |item|
		new_item = Item.new(item) if item
		@items << new_item
	end
end

Instance Method Details

#add_item(item) ⇒ Object

add item to items list



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

def add_item item
	@items << item
end

#has_items?Boolean

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

Returns:

  • (Boolean)


17
18
19
# File 'lib/julianus/claim.rb', line 17

def has_items?
	@items.length > 0
end

#itemsObject

returns list of items claim has



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

def items
	@items
end

#to_sObject



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

def to_s
	result = []
	@items.each do |item|
		result << item
	end
	result
end