Class: Item
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Item
- Defined in:
- app/models/item.rb
Overview
This class describes an item.
Instance Method Summary (collapse)
-
- (Object) method_missing(action, *args)
Execute missing method.
-
- (String) name
Return the name of item.
-
- (String) quality_txt
Return the quality text of item.
-
- (Integer) rq_prod_point
Return item_info.rq_prod_point.
-
- (String) status
Return the status of item.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
- (Object) method_missing(action, *args)
Note:
This method is used for calling ItemInfo method without specifying class name.
Execute missing method.
52 53 54 |
# File 'app/models/item.rb', line 52 def method_missing(action, *args) eval("item_info." + action.to_s) end |
Instance Method Details
- (String) name
Return the name of item.
15 16 17 |
# File 'app/models/item.rb', line 15 def name return item_info.name + quality_txt end |
- (String) quality_txt
Return the quality text of item. '+' or '-' is added before the quality value.
22 23 24 25 26 27 28 29 30 |
# File 'app/models/item.rb', line 22 def quality_txt return '' if quality.blank? quality_txt = quality.to_s if quality < 0 return quality_txt else return '+' + quality_txt end end |
- (Integer) rq_prod_point
Return item_info.rq_prod_point. This function is provided to keep same interface among mini_map_cell, mini_map_road and item.
35 36 37 |
# File 'app/models/item.rb', line 35 def rq_prod_point return item_info.rq_prod_point end |
- (String) status
Return the status of item.
41 42 43 44 45 46 47 48 |
# File 'app/models/item.rb', line 41 def status return I18n.t('activerecord.attributes.item.building') if rq_prod_point > built_point if mob.blank? return I18n.t('activerecord.attributes.item.not_equiped') else return mob.name + I18n.t('activerecord.attributes.item.equiping') end end |