Sha256: a8b7d4f31d0dcda1a3903a4dfba155d52ee7dc4f6640510ea14b416cdfc1f8e4

Contents?: true

Size: 725 Bytes

Versions: 11

Compression:

Stored size: 725 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], repo)
        end

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

        def image
          @image && File.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

11 entries across 11 versions & 1 rubygems

Version Path
dato-0.6.8 lib/dato/local/field_type/seo.rb
dato-0.6.7 lib/dato/local/field_type/seo.rb
dato-0.6.6 lib/dato/local/field_type/seo.rb
dato-0.6.5 lib/dato/local/field_type/seo.rb
dato-0.6.3 lib/dato/local/field_type/seo.rb
dato-0.6.3.beta lib/dato/local/field_type/seo.rb
dato-0.6.2 lib/dato/local/field_type/seo.rb
dato-0.6.1 lib/dato/local/field_type/seo.rb
dato-0.6.0 lib/dato/local/field_type/seo.rb
dato-0.5.1 lib/dato/local/field_type/seo.rb
dato-0.5.0 lib/dato/local/field_type/seo.rb