Class: Dato::Local::Site
- Inherits:
-
Object
- Object
- Dato::Local::Site
- Extended by:
- Forwardable
- Defined in:
- lib/dato/local/site.rb
Instance Attribute Summary collapse
-
#entity ⇒ Object
readonly
Returns the value of attribute entity.
Instance Method Summary collapse
- #favicon ⇒ Object
- #favicon_meta_tags(theme_color = nil) ⇒ Object
- #global_seo ⇒ Object
-
#initialize(entity, items_repo) ⇒ Site
constructor
A new instance of Site.
- #theme ⇒ Object
- #to_hash ⇒ Object
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(entity, items_repo) ⇒ Site
Returns a new instance of Site.
16 17 18 19 |
# File 'lib/dato/local/site.rb', line 16 def initialize(entity, items_repo) @entity = entity @items_repo = items_repo end |
Instance Attribute Details
#entity ⇒ Object (readonly)
Returns the value of attribute entity.
11 12 13 |
# File 'lib/dato/local/site.rb', line 11 def entity @entity end |
Instance Method Details
#favicon ⇒ Object
29 30 31 |
# File 'lib/dato/local/site.rb', line 29 def favicon read_attribute(:favicon, FieldType::UploadId, false) end |
#favicon_meta_tags(theme_color = nil) ⇒ Object
38 39 40 |
# File 'lib/dato/local/site.rb', line 38 def (theme_color = nil) Utils::FaviconTagsBuilder.new(self, theme_color). end |
#global_seo ⇒ Object
21 22 23 |
# File 'lib/dato/local/site.rb', line 21 def global_seo read_attribute(:global_seo, FieldType::GlobalSeo, locales.size > 1) end |
#theme ⇒ Object
25 26 27 |
# File 'lib/dato/local/site.rb', line 25 def theme read_attribute(:theme, FieldType::Theme, false) end |
#to_hash ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/dato/local/site.rb', line 42 def to_hash attributes = %i[ id name locales theme domain internal_domain no_index global_seo favicon frontend_url ] attributes.each_with_object({}) do |attribute, result| value = send(attribute) result[attribute] = if value.respond_to?(:to_hash) value.to_hash else value end end end |
#to_s ⇒ Object Also known as: inspect
33 34 35 |
# File 'lib/dato/local/site.rb', line 33 def to_s "#<Site id=#{id} site_name=#{name}>" end |