Sha256: 25a74fff924bf3d7e0fee2ca9b3c03c0077196bd0a9b845a59a3427a8da72b09

Contents?: true

Size: 676 Bytes

Versions: 3

Compression:

Stored size: 676 Bytes

Contents

# frozen_string_literal: true
module Dato
  module Local
    module FieldType
      class Seo
        attr_reader :title, :description

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

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

        def image
          @image && Image.parse(@image, nil)
        end

        def to_hash
          {
            title: title,
            description: description,
            image: image && image.to_hash
          }
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dato-0.3.6 lib/dato/local/field_type/seo.rb
dato-0.3.5 lib/dato/local/field_type/seo.rb
dato-0.3.3 lib/dato/local/field_type/seo.rb