Class: Label::Base

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/label/base.rb

Overview

Copyright 2011 innoQ Deutschland GmbH

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Direct Known Subclasses

SKOS::Base

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object



82
83
84
# File 'app/models/label/base.rb', line 82

def <=>(other)
  self.to_s.downcase <=> other.to_s.downcase
end

#published?Boolean

********* Methods

Returns:

  • (Boolean)


78
79
80
# File 'app/models/label/base.rb', line 78

def published?
  true
end

#to_literalObject



86
87
88
# File 'app/models/label/base.rb', line 86

def to_literal
  "\"#{value}\"@#{language}"
end

#to_sObject



90
91
92
93
94
95
96
# File 'app/models/label/base.rb', line 90

def to_s
  if language.to_s != I18n.locale.to_s.strip
    value.to_s + " [#{I18n.t("txt.common.translation_missing_for")} '#{I18n.locale.to_s.strip}']"
  else
    value.to_s
  end
end