Class: Agave::Local::FieldType::GlobalSeo

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(site_name, title_suffix, twitter_account, facebook_page_url, fallback_seo, repo) ⇒ GlobalSeo

Returns a new instance of GlobalSeo.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/agave/local/field_type/global_seo.rb', line 24

def initialize(
  site_name,
  title_suffix,
  ,
  facebook_page_url,
  fallback_seo,
  repo
)
  @site_name = site_name
  @title_suffix = title_suffix
  @twitter_account = 
  @facebook_page_url = facebook_page_url
  @fallback_seo = fallback_seo
  @repo = repo
end

Instance Attribute Details

#facebook_page_urlObject (readonly)

Returns the value of attribute facebook_page_url.



11
12
13
# File 'lib/agave/local/field_type/global_seo.rb', line 11

def facebook_page_url
  @facebook_page_url
end

#site_nameObject (readonly)

Returns the value of attribute site_name.



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

def site_name
  @site_name
end

#title_suffixObject (readonly)

Returns the value of attribute title_suffix.



9
10
11
# File 'lib/agave/local/field_type/global_seo.rb', line 9

def title_suffix
  @title_suffix
end

#twitter_accountObject (readonly)

Returns the value of attribute twitter_account.



10
11
12
# File 'lib/agave/local/field_type/global_seo.rb', line 10

def 
  @twitter_account
end

Class Method Details

.parse(value, repo) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/agave/local/field_type/global_seo.rb', line 13

def self.parse(value, repo)
  value && new(
    value[:site_name],
    value[:title_suffix],
    value[:twitter_account],
    value[:facebook_page_url],
    value[:fallback_seo],
    repo
  )
end

Instance Method Details

#fallback_seoObject



40
41
42
# File 'lib/agave/local/field_type/global_seo.rb', line 40

def fallback_seo
  @fallback_seo && Seo.parse(@fallback_seo, @repo)
end

#to_hash(*args) ⇒ Object



44
45
46
47
48
49
50
51
52
# File 'lib/agave/local/field_type/global_seo.rb', line 44

def to_hash(*args)
  {
    site_name: site_name,
    title_suffix: title_suffix,
    twitter_account: ,
    facebook_page_url: facebook_page_url,
    fallback_seo: fallback_seo && fallback_seo.to_hash(*args)
  }
end