Class: Subfamily

Inherits:
Taxon
  • Object
show all
Defined in:
app/models/subfamily.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)



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/models/subfamily.rb', line 8

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

    attributes = {
      name: data[:name],
      fossil: data[:fossil] || false,
      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
    subfamily = create! attributes
    data[:taxonomic_history].each do |item|
      subfamily.taxonomic_history_items.create! taxt: item
    end

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

    subfamily
  end
end

Instance Method Details

- (Object) children



34
35
36
# File 'app/models/subfamily.rb', line 34

def children
  tribes
end

- (Object) full_label



42
43
44
# File 'app/models/subfamily.rb', line 42

def full_label
  full_name
end

- (Object) full_name



38
39
40
# File 'app/models/subfamily.rb', line 38

def full_name
  name
end

- (Object) statistics



46
47
48
# File 'app/models/subfamily.rb', line 46

def statistics
  get_statistics [:genera, :species, :subspecies]
end