Class: EveApp::Type

Inherits:
ApplicationRecord show all
Defined in:
app/models/eve_app/type.rb

Instance Method Summary collapse

Instance Method Details

#accessoire?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'app/models/eve_app/type.rb', line 39

def accessoire?
  category_id == EveApp::Category::ACCESSOIRE
end

#blueprint?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'app/models/eve_app/type.rb', line 35

def blueprint?
  category_id == EveApp::Category::BLUEPRINT
end

#capital?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'app/models/eve_app/type.rb', line 51

def capital?
  EveApp::Group::CAPITALS.include?(group_id)
end

#component?Boolean

Returns:

  • (Boolean)


59
60
61
# File 'app/models/eve_app/type.rb', line 59

def component?
  EveApp::Group::COMPONENTS.include?(group_id)
end

#descriptionObject



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

#kindObject



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

Returns:

  • (Boolean)


47
48
49
# File 'app/models/eve_app/type.rb', line 47

def mineral?
  group_id == EveApp::Group::MINERAL
end

#ship?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'app/models/eve_app/type.rb', line 43

def ship?
  category_id == EveApp::Category::SHIP
end

#sort_keyObject



71
72
73
# File 'app/models/eve_app/type.rb', line 71

def sort_key
  @_sort_key ||= [sort_index, name].join('-')
end

#supercapital?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'app/models/eve_app/type.rb', line 55

def supercapital?
  EveApp::Group::SUPER_CAPITALS.include?(group_id)
end