Sha256: fc8149b9f20ab84eab72f78e817cc0dfeaab8a13eb2318de0e6232bbf521c9dd

Contents?: true

Size: 820 Bytes

Versions: 12

Compression:

Stored size: 820 Bytes

Contents

# frozen_string_literal: true

module Dato
  module Local
    module FieldType
      class Seo
        attr_reader :title, :description, :twitter_card

        def self.parse(value, repo)
          value && new(value[:title], value[:description], value[:image], value[:twitter_card], repo)
        end

        def initialize(title, description, image, twitter_card, repo)
          @title = title
          @description = description
          @image = image
          @repo = repo
          @twitter_card = twitter_card
        end

        def image
          @image && UploadId.parse(@image, @repo)
        end

        def to_hash(*args)
          {
            title: title,
            description: description,
            image: image && image.to_hash(*args)
          }
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
dato-0.8.0 lib/dato/local/field_type/seo.rb
dato-0.7.18 lib/dato/local/field_type/seo.rb
dato-0.7.17 lib/dato/local/field_type/seo.rb
dato-0.7.16 lib/dato/local/field_type/seo.rb
dato-0.7.15 lib/dato/local/field_type/seo.rb
dato-0.7.14 lib/dato/local/field_type/seo.rb
dato-0.7.13 lib/dato/local/field_type/seo.rb
dato-0.7.10 lib/dato/local/field_type/seo.rb
dato-0.7.9 lib/dato/local/field_type/seo.rb
dato-0.7.8 lib/dato/local/field_type/seo.rb
dato-0.7.7 lib/dato/local/field_type/seo.rb
dato-0.7.6 lib/dato/local/field_type/seo.rb