Class: Taxon

Inherits:
Data
  • Object
show all
Defined in:
lib/inat-channel/data_types.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ancestorsObject (readonly)

Returns the value of attribute ancestors

Returns:

  • (Object)

    the current value of ancestors



73
74
75
# File 'lib/inat-channel/data_types.rb', line 73

def ancestors
  @ancestors
end

#common_nameObject (readonly)

Returns the value of attribute common_name

Returns:

  • (Object)

    the current value of common_name



73
74
75
# File 'lib/inat-channel/data_types.rb', line 73

def common_name
  @common_name
end

#idObject (readonly)

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



73
74
75
# File 'lib/inat-channel/data_types.rb', line 73

def id
  @id
end

#scientific_nameObject (readonly)

Returns the value of attribute scientific_name

Returns:

  • (Object)

    the current value of scientific_name



73
74
75
# File 'lib/inat-channel/data_types.rb', line 73

def scientific_name
  @scientific_name
end

Instance Method Details

#iconObject



74
75
76
# File 'lib/inat-channel/data_types.rb', line 74

def icon
  IC::ancestors_icon ancestors.map(&:id)
end

#titleObject



77
78
79
80
81
82
83
# File 'lib/inat-channel/data_types.rb', line 77

def title
  if common_name && !common_name.empty?
    "<b>#{common_name}</b> <i>(#{scientific_name})</i>"
  else
    "<b><i>#{scientific_name}</i></b>"
  end
end

#to_tagsObject



87
88
89
# File 'lib/inat-channel/data_types.rb', line 87

def to_tags
  ancestors.to_tags
end

#urlObject



84
85
86
# File 'lib/inat-channel/data_types.rb', line 84

def url
  "https://www.inaturalist.org/taxa/#{id}"
end