Class: ItemInfo

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/item_info.rb

Overview

This class describes an item information. The upper class of Item.

Instance Method Summary (collapse)

Instance Method Details

- (String) element_symbol_txt

Return the description of element.

Returns:

  • (String)


44
45
46
# File 'app/models/item_info.rb', line 44

def element_symbol_txt
  return I18n.t('activerecord.attributes.element.' + element_symbol)
end

- (String) rq_sp_resource_txt

Return the description of required sp_resource of item_info.

Returns:

  • (String)

    Comma separated sp_resource.name



16
17
18
19
20
21
22
23
24
# File 'app/models/item_info.rb', line 16

def rq_sp_resource_txt
  rq_sp_resource_txt = ''
  item_sp_resource_invs.each do |item_sp_resource_inv|
    rq_sp_resource_txt += item_sp_resource_inv.sp_resource.name
    rq_sp_resource_txt += ','
  end
  rq_sp_resource_txt.chop! if rq_sp_resource_txt.last == ','
  return rq_sp_resource_txt
end

- (Array) rq_sp_resources_all

Return all the required sp_resource of item_info.

Returns:

  • (Array)

    array of sp_resource



28
29
30
31
32
33
34
# File 'app/models/item_info.rb', line 28

def rq_sp_resources_all
  rq_sp_resources = Array.new
  item_sp_resource_invs.each do |item_sp_resource_inv|
    rq_sp_resources << item_sp_resource_inv.sp_resource
  end
  return rq_sp_resources
end

- (String) type_symbol_txt

Return the description of item info type.

Returns:

  • (String)


38
39
40
# File 'app/models/item_info.rb', line 38

def type_symbol_txt
  return I18n.t('activerecord.attributes.item_info.' + type_symbol)
end