Sha256: 794bd23a44196588b6c5b8b76c19680b2cf4d48a69c7868d06c183eaeb2e93ae

Contents?: true

Size: 790 Bytes

Versions: 8

Compression:

Stored size: 790 Bytes

Contents

module GeoConcerns
  class TimePeriod
    attr_accessor :doc, :initial_value
    def initialize(initial_value, doc)
      @initial_value = initial_value || []
      @doc = doc
    end

    def value
      append_caldate
      append_begdate
      initial_value.uniq!
      initial_value
    end

    private

      def append_caldate
        doc.at_xpath('//idinfo/timeperd/timeinfo/mdattim/sngdate/caldate | //idinfo/timeperd/timeinfo/sngdate/caldate').tap do |node|
          initial_value << node.text[0..3] unless node.nil? # extract year only
        end
      end

      def append_begdate
        doc.at_xpath('//idinfo/timeperd/timeinfo/rngdates/begdate').tap do |node|
          initial_value << node.text[0..3] unless node.nil? # extract year only
        end
      end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
geo_concerns-0.3.4 app/values/geo_concerns/time_period.rb
geo_concerns-0.3.3 app/values/geo_concerns/time_period.rb
geo_concerns-0.3.2 app/values/geo_concerns/time_period.rb
geo_concerns-0.3.1 app/values/geo_concerns/time_period.rb
geo_concerns-0.3.0 app/values/geo_concerns/time_period.rb
geo_concerns-0.2.0 app/values/geo_concerns/time_period.rb
geo_concerns-0.1.1 app/values/geo_concerns/time_period.rb
geo_concerns-0.1.0 app/values/geo_concerns/time_period.rb