app/models/data_point_uri.rb
# TODO - this logic is duplicated in the taxa helper; remove it from there.
# Maybe move to DataValue?
this logic is duplicated in the taxa helper; remove it from there.
this logic is duplicated in the taxa helper ; remove it from there .
def value_string(lang = Language.default, options={})
    return @value_string unless @value_string.blank?
    @value_string = nil
    if association? && target_taxon_concept
      if common_name =
        target_taxon_concept.preferred_common_name_in_language(lang)
        @value_string = common_name
      else
        @value_string = target_taxon_concept.title_canonical
      end
    else
      val = EOL::Sparql.uri_components(object_uri)[:label].to_s
      if val.is_numeric?
        if val.is_float?
          @value_string = val.to_f.round(2)
        else
          @value_string = val.to_i
        end
      end
      @value_string = options[:hash_data] ? val : val.add_missing_hyperlinks
    end
    return @value_string
  end
def value_string ( lang = Language . default , options = { } ) return @value_string unless @value_string . blank? @value_string = nil if association? && target_taxon_concept if common_name = target_taxon_concept . preferred_common_name_in_language ( lang ) @value_string = common_name else @value_string = target_taxon_concept . title_canonical end else val = EOL :: Sparql . uri_components ( object_uri ) [ :label ] . to_s if val . is_numeric? if val . is_float? @value_string = val . to_f . round ( 2 ) else @value_string = val . to_i end end @value_string = options [ :hash_data ] ? val : val . add_missing_hyperlinks end return @value_string end
TODO - this logic is duplicated in the taxa helper; remove it from there.
TODO - this logic is duplicated in the taxa helper ; remove it from there .
# TODO - see if we need this #to_s; seems redundant: # float values can be rounded off to 2 decimal places # other values may have links embedded in them (references, citations, # etc.) TODO - this should be saved in the DB somewhere.
lang
<not_specific>
default
<not_specific>
options
<not_specific>