Class: WaffleCal::ProdId

Inherits:
Object
  • Object
show all
Defined in:
lib/waffle_cal/prod_id.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ ProdId

Returns a new instance of ProdId.



6
7
8
9
10
# File 'lib/waffle_cal/prod_id.rb', line 6

def initialize(attrs={})
	@entity_name = attrs[:entity_name]
	@product_name = attrs[:product_name]
	@language = attrs[:language].upcase if attrs.has_key?(:language)
end

Instance Attribute Details

#entity_nameObject

Returns the value of attribute entity_name.



4
5
6
# File 'lib/waffle_cal/prod_id.rb', line 4

def entity_name
  @entity_name
end

#languageObject

Returns the value of attribute language.



4
5
6
# File 'lib/waffle_cal/prod_id.rb', line 4

def language
  @language
end

#product_nameObject

Returns the value of attribute product_name.



4
5
6
# File 'lib/waffle_cal/prod_id.rb', line 4

def product_name
  @product_name
end

Class Method Details

.create(entity_name, product_name, language) ⇒ Object



12
13
14
# File 'lib/waffle_cal/prod_id.rb', line 12

def self.create(entity_name, product_name, language)
	ProdId.new({entity_name: entity_name, product_name: product_name, language: language})
end

Instance Method Details

#to_sObject



16
17
18
19
20
21
22
# File 'lib/waffle_cal/prod_id.rb', line 16

def to_s
	if complete?
		"//#{@entity_name}//#{@product_name}//#{@language}"
	else
		default_prod_id.to_s
	end
end