Class: Agave::Local::FieldType::Seo

Inherits:
Object
  • Object
show all
Defined in:
lib/agave/local/field_type/seo.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, description, image, repo) ⇒ Seo

Returns a new instance of Seo.



12
13
14
15
16
17
# File 'lib/agave/local/field_type/seo.rb', line 12

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

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



6
7
8
# File 'lib/agave/local/field_type/seo.rb', line 6

def description
  @description
end

#titleObject (readonly)

Returns the value of attribute title.



6
7
8
# File 'lib/agave/local/field_type/seo.rb', line 6

def title
  @title
end

Class Method Details

.parse(value, repo) ⇒ Object



8
9
10
# File 'lib/agave/local/field_type/seo.rb', line 8

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

Instance Method Details

#imageObject



19
20
21
# File 'lib/agave/local/field_type/seo.rb', line 19

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

#to_hash(*args) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/agave/local/field_type/seo.rb', line 23

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