class Planefinder::AirplaneCategory
Contains categories like “Single Engine Piston” or “Jet” or “Turbine Helicopter”
Attributes
count[R]
id[R]
name[R]
sort_priority[R]
Public Class Methods
new(json_category)
click to toggle source
# File lib/planefinder/airplane_category.rb, line 6 def initialize(json_category) validate_category(json_category) @count = json_category['count'].to_i @id = json_category['id'].to_i @name = json_category['name'].to_s @sort_priority = json_category['sort_priority'].to_i end
Public Instance Methods
==(other)
click to toggle source
# File lib/planefinder/airplane_category.rb, line 19 def ==(other) @count == other.count && @id == other.id && @name == other.name && @sort_priority == other.sort_priority end
get_makes()
click to toggle source
# File lib/planefinder/airplane_category.rb, line 26 def get_makes Planefinder.get_makes_for_category(self) end
validate_category(cat)
click to toggle source
# File lib/planefinder/airplane_category.rb, line 14 def validate_category(cat) throw "Category must have count, id, name, and sort_priority fields" unless ['count', 'id', 'name', 'sort_priority'].all? { |field| cat.include?(field) } end