Class: Dato::Local::FieldType::Seo
- Inherits:
-
Object
- Object
- Dato::Local::FieldType::Seo
- Defined in:
- lib/dato/local/field_type/seo.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#twitter_card ⇒ Object
readonly
Returns the value of attribute twitter_card.
Class Method Summary collapse
Instance Method Summary collapse
- #image ⇒ Object
-
#initialize(title, description, image, twitter_card, repo) ⇒ Seo
constructor
A new instance of Seo.
- #to_hash(*args) ⇒ Object
Constructor Details
#initialize(title, description, image, twitter_card, repo) ⇒ Seo
Returns a new instance of Seo.
13 14 15 16 17 18 19 |
# File 'lib/dato/local/field_type/seo.rb', line 13 def initialize(title, description, image, twitter_card, repo) @title = title @description = description @image = image @repo = repo @twitter_card = twitter_card end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
7 8 9 |
# File 'lib/dato/local/field_type/seo.rb', line 7 def description @description end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
7 8 9 |
# File 'lib/dato/local/field_type/seo.rb', line 7 def title @title end |
#twitter_card ⇒ Object (readonly)
Returns the value of attribute twitter_card.
7 8 9 |
# File 'lib/dato/local/field_type/seo.rb', line 7 def twitter_card @twitter_card end |
Class Method Details
.parse(value, repo) ⇒ Object
9 10 11 |
# File 'lib/dato/local/field_type/seo.rb', line 9 def self.parse(value, repo) value && new(value[:title], value[:description], value[:image], value[:twitter_card], repo) end |
Instance Method Details
#image ⇒ Object
21 22 23 |
# File 'lib/dato/local/field_type/seo.rb', line 21 def image @image && UploadId.parse(@image, @repo) end |
#to_hash(*args) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/dato/local/field_type/seo.rb', line 25 def to_hash(*args) { title: title, description: description, image: image && image.to_hash(*args), } end |