Sha256: 1156182baf26573981d924cc9bea2dcd70a7ce452e9de086fc12ed007d218117

Contents?: true

Size: 529 Bytes

Versions: 3

Compression:

Stored size: 529 Bytes

Contents

require "indieweb/post_types/identifier/read/version"

module Indieweb
  module PostTypes
    module Identifier
      module Read
        def self.type_from(data)
          data = entry_data_from(data)
          return unless data.key?('read-of')

          'read'
        end

        private

        def self.entry_data_from(data)
          return data['properties'] if data.key?('properties')
          return data unless data.key?('items')
          data['items'].first['properties']
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
indieweb-post_types-identifier-read-0.2.1 lib/indieweb/post_types/identifier/read.rb
indieweb-post_types-identifier-read-0.2.0 lib/indieweb/post_types/identifier/read.rb
indieweb-post_types-identifier-read-0.1.0 lib/indieweb/post_types/identifier/read.rb