lib/destiny_rb/item_explorer.rb
# Item Explorer Rarity definitions
#
# Usage:
#   client.enemy_race(:vex)
#   client.enemy_race(711470098)
#
# Arguments:
#   type: (String/Symbol)
#
# Returns:
#   Either the numeric representation of a enemy race or a symbol of said race.


(String/Symbol)

Either the numeric representation of a enemy race or a symbol of said race.
( String / Symbol ) Either the numeric representation of a enemy race or a symbol of said race .
def rarity(type)
      types = {
        none: 0,
        currency: 1,
        basic: 2,
        common: 3,
        rare: 4,
        superior: 5,
        exotic: 6
        }
      if type.is_a? Numeric
          requested_type = types.key(type) || :none
      else type.is_a? Symbol
          requested_type = types.fetch(type, 0) 
      end
    end
def rarity ( type ) types = { none : 0 , currency : 1 , basic : 2 , common : 3 , rare : 4 , superior : 5 , exotic : 6 } if type . is_a? Numeric requested_type = types . key ( type ) || :none else type . is_a? Symbol requested_type = types . fetch ( type , 0 ) end end
Item Explorer Rarity definitions
Usage:
client.enemy_race(:vex)
client.enemy_race(711470098)
Item Explorer Rarity definitions Usage : client . enemy_race ( : vex ) client . enemy_race ( 711470098 )
# Fetch type from hash, if type doesn't match return 'none' # Fetch type from hash, if type doesn't match return 0 for 'none'
type
<not_specific>