lib/rdf/xsd/duration.rb
def humanize(lang = :en)
      @humanize ||= {}
      @humanize[lang] ||= begin
        # Just english, for now
        ar = []
        ar << plural(@object[:yr], "year")
        ar << plural(@object[:mo], "month")
        ar << plural(@object[:da], "day")
        ar << plural(@object[:hr], "hour")
        ar << plural(@object[:mi], "minute")
        ar << plural(sec_str, "second") if @object[:se]
        ar = ar.compact
        last = ar.pop
        first = ar.join(" ")
        res = first.empty? ? last : "#{first} and #{last}"
        @object[:si] == '-' ? "#{res} ago" : res
      end
    end
##
# Returns a human-readable value for the interval
Returns a human-readable value for the interval
Returns a human - readable value for the interval
def humanize(lang = :en)
      @humanize ||= {}
      @humanize[lang] ||= begin
        ar = []
        ar << plural(@object[:yr], "year")
        ar << plural(@object[:mo], "month")
        ar << plural(@object[:da], "day")
        ar << plural(@object[:hr], "hour")
        ar << plural(@object[:mi], "minute")
        ar << plural(sec_str, "second") if @object[:se]
        ar = ar.compact
        last = ar.pop
        first = ar.join(" ")
        res = first.empty? ? last : "#{first} and #{last}"
        @object[:si] == '-' ? "#{res} ago" : res
      end
    end
def humanize ( lang = :en ) @humanize ||= { } @humanize [ lang ] ||= begin ar = [ ] ar << plural ( @object [ :yr ] , "year" ) ar << plural ( @object [ :mo ] , "month" ) ar << plural ( @object [ :da ] , "day" ) ar << plural ( @object [ :hr ] , "hour" ) ar << plural ( @object [ :mi ] , "minute" ) ar << plural ( sec_str , "second" ) if @object [ :se ] ar = ar . compact last = ar . pop first = ar . join ( " " ) res = first . empty? ? last : "#{first} and #{last}" @object [ :si ] == '-' ? "#{res} ago" : res end end
Returns a human-readable value for the interval
Returns a human - readable value for the interval
# Just english, for now
lang