Sha256: d88021ae1f4476bcb6a031635c8f54c9f1608063191845735b47ed61c47d8dbf

Contents?: true

Size: 522 Bytes

Versions: 1

Compression:

Stored size: 522 Bytes

Contents

module IsoDoc
  module ClassUtils

    def date_range(date)
      from = date.at(ns("./from"))
      to = date.at(ns("./to"))
      on = date.at(ns("./on"))
      return on.text if on
      ret = "#{from.text}–"
      ret += to.text if to
      ret
    end

    def ns(xpath)
      xpath.gsub(%r{/([a-zA-z])}, "/xmlns:\\1").
        gsub(%r{::([a-zA-z])}, "::xmlns:\\1").
        gsub(%r{\[([a-zA-z][a-z0-9A-Z@/]* ?=)}, "[xmlns:\\1").
        gsub(%r{\[([a-zA-z][a-z0-9A-Z@/]*\])}, "[xmlns:\\1")
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
isodoc-0.8 lib/isodoc/class_utils.rb