Class: EveApp::Type
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- EveApp::Type
- Defined in:
- app/models/eve_app/type.rb
Instance Method Summary collapse
- #accessoire? ⇒ Boolean
- #blueprint? ⇒ Boolean
- #capital? ⇒ Boolean
- #component? ⇒ Boolean
- #description ⇒ Object
- #image(size = 64) ⇒ Object
- #kind ⇒ Object
- #mineral? ⇒ Boolean
- #ship? ⇒ Boolean
- #sort_key ⇒ Object
- #supercapital? ⇒ Boolean
Instance Method Details
#accessoire? ⇒ Boolean
39 40 41 |
# File 'app/models/eve_app/type.rb', line 39 def accessoire? category_id == EveApp::Category::ACCESSOIRE end |
#blueprint? ⇒ Boolean
35 36 37 |
# File 'app/models/eve_app/type.rb', line 35 def blueprint? category_id == EveApp::Category::BLUEPRINT end |
#capital? ⇒ Boolean
51 52 53 |
# File 'app/models/eve_app/type.rb', line 51 def capital? EveApp::Group::CAPITALS.include?(group_id) end |
#component? ⇒ Boolean
59 60 61 |
# File 'app/models/eve_app/type.rb', line 59 def component? EveApp::Group::COMPONENTS.include?(group_id) end |
#description ⇒ Object
67 68 69 |
# File 'app/models/eve_app/type.rb', line 67 def description category.name end |
#image(size = 64) ⇒ Object
63 64 65 |
# File 'app/models/eve_app/type.rb', line 63 def image(size=64) "https://image.eveonline.com/Type/#{id}_#{size}.png" end |
#kind ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/models/eve_app/type.rb', line 20 def kind case group_id when *EveApp::Group::MINERAL then :mineral when EveApp::Group::CAPITAL_COMPONENT then :capital_component when *EveApp::Group::COMPONENTS then :component when *EveApp::Group::SUPER_CAPITALS then :supercapital when *EveApp::Group::CAPITALS then :capital else case market_group_root_id when EveApp::MarketGroup::SHIP_MODIFICATIONS then :rig else category_name.downcase.gsub(' ', '_').to_sym end end end |
#mineral? ⇒ Boolean
47 48 49 |
# File 'app/models/eve_app/type.rb', line 47 def mineral? group_id == EveApp::Group::MINERAL end |
#ship? ⇒ Boolean
43 44 45 |
# File 'app/models/eve_app/type.rb', line 43 def ship? category_id == EveApp::Category::SHIP end |
#sort_key ⇒ Object
71 72 73 |
# File 'app/models/eve_app/type.rb', line 71 def sort_key @_sort_key ||= [sort_index, name].join('-') end |
#supercapital? ⇒ Boolean
55 56 57 |
# File 'app/models/eve_app/type.rb', line 55 def supercapital? EveApp::Group::SUPER_CAPITALS.include?(group_id) end |