Class: Expansion

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
FriendlyId
Defined in:
app/models/expansion.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.missingObject


56
57
58
# File 'app/models/expansion.rb', line 56

def self.missing
	return :expansion_missing
end

.unknownObject


53
54
55
# File 'app/models/expansion.rb', line 53

def self.unknown
	return :expansion_unknown
end

Instance Method Details

#copy_from_edition(edition) ⇒ Object


33
34
35
36
37
38
39
# File 'app/models/expansion.rb', line 33

def copy_from_edition(edition)
	self.title = edition.title
	self.description = edition.description
	self.release_date = edition.release_date
	self.created_at = edition.created_at
	self.coverart = edition.coverart
end

#coverart_remote_url=(url_value) ⇒ Object


41
42
43
44
# File 'app/models/expansion.rb', line 41

def coverart_remote_url=(url_value)
	self.coverart = URI.parse(url_value)
	@coverart_remote_url = url_value
end

#delete_coverartObject


46
47
48
# File 'app/models/expansion.rb', line 46

def delete_coverart
	@delete_coverart ||= false
end

#delete_coverart=(value) ⇒ Object


50
51
52
# File 'app/models/expansion.rb', line 50

def delete_coverart=(value)
	@delete_coverart  = !value.to_i.zero?
end

#normalize_friendly_id(input) ⇒ Object


8
9
10
# File 'app/models/expansion.rb', line 8

def normalize_friendly_id(input)
	input.to_s.to_slug.normalize.to_s
end

#title_and_platformObject


12
13
14
15
16
17
18
19
20
21
22
# File 'app/models/expansion.rb', line 12

def title_and_platform
	[
		:title,
		[->{ edition.platform.display_title if edition }, :title],
		[->{ edition.platform.display_title if edition }, ->{ edition.region.title if edition }, :title],
		[:title, 2],
		[:title, 3],
		[:title, 4],
		[:title, 5]
	]
end