Class: Tribe

Inherits:
Taxon
  • Object
show all
Defined in:
app/models/tribe.rb

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Taxon

#available?, #convert_asterisks_to_daggers!, #current_valid_name, #excluded?, find_genus_group_by_name, find_name, get_statistics, #get_statistics, #homonym?, #homonym_replaced_by?, #incertae_sedis_in?, #invalid?, massage_count, #rank, statistics, #synonym?, #synonym_of?, #unavailable?, #unidentifiable?, #unresolved_homonym?

Class Method Details

+ (Object) import(data)



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'app/models/tribe.rb', line 25

def self.import data
  transaction do
    protonym = Protonym.import data[:protonym]

    attributes = {
      name: data[:name],
      fossil: data[:fossil] || false,
      subfamily: data[:subfamily],
      synonym_of: data[:synonym_of],
      status: data[:status] || 'valid',
      protonym: protonym,
    }
    if data[:type_genus]
      type_genus_taxt = Importers::Bolton::Catalog::TextToTaxt.convert(data[:type_genus][:texts])
      attributes[:type_taxon_taxt] = type_genus_taxt
    end

    tribe = create! attributes

    data[:taxonomic_history].each do |item|
      tribe.taxonomic_history_items.create! taxt: item
    end

    type_genus = data[:type_genus]
    ForwardReference.create! source_id: tribe.id, 
      target_name: type_genus[:genus_name], fossil: type_genus[:fossil] if type_genus

    tribe
  end
end

Instance Method Details

- (Object) children



6
7
8
# File 'app/models/tribe.rb', line 6

def children
  genera
end

- (Object) full_label



14
15
16
# File 'app/models/tribe.rb', line 14

def full_label
  full_name
end

- (Object) full_name



10
11
12
# File 'app/models/tribe.rb', line 10

def full_name
  name
end

- (Object) siblings



21
22
23
# File 'app/models/tribe.rb', line 21

def siblings
  subfamily.tribes
end

- (Object) statistics



18
19
# File 'app/models/tribe.rb', line 18

def statistics
end