Sha256: 14d5f27ec7a6207c3b644ef7c995e72f4cf0e5e4d1a593ceffce8e80694e5976

Contents?: true

Size: 545 Bytes

Versions: 2

Compression:

Stored size: 545 Bytes

Contents

module Indieweb
  module PostTypes
    module Identifier
      module Photo
        extend Indieweb::PostTypes::Identifier::Base

        class << self
          private

          def identifier_from(data)
            return unless data.key?('photo')
            return unless valid_url?(url_from(data['photo']))

            'photo'
          end

          def url_from(data)
            photo = data.is_a?(Array) ? data[0] : data
            photo.is_a?(String) ? photo : photo['value']
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
indieweb-post_types-0.3.2 lib/indieweb/post_types/identifier/photo.rb
indieweb-post_types-0.3.1 lib/indieweb/post_types/identifier/photo.rb