Sha256: 252cab42d84ff1df78ab911fcc70ecd7f5c0238c1c3f46c79cd55d5f292f833c

Contents?: true

Size: 816 Bytes

Versions: 3

Compression:

Stored size: 816 Bytes

Contents

module Eader
  class Item
    attr_accessor :node

    def initialize(node)
      @node = node
    end

    def unitid
      if (uid = node.css('unitid')).any?
        uid[0].text.strip
      end
    end

    def origination
      if (orig = node.css('origination')).any?
        orig[0].text.strip
      end
    end

    def langmaterial
      if (langm = node.css('langmaterial')).any?
        langm[0].text.strip
      end
    end

    def unittitle
      if (ut = node.css('unittitle')).any?
        ut[0].text.strip
      end
    end

    def unitdate
      if _unit_dates.any?
        _unit_dates[0].text.strip
      end
    end

    def unitdate_type
      if _unit_dates.any?
        _unit_dates[0].attr('type')
      end
    end

    private
    def _unit_dates
      node.css('unitdate')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
eader-0.0.3 lib/eader/item.rb
eader-0.0.2 lib/eader/item.rb
eader-0.0.1 lib/eader/item.rb