class Dato::Local::Site
Attributes
entity[R]
Public Class Methods
new(entity, items_repo)
click to toggle source
# File lib/dato/local/site.rb, line 18 def initialize(entity, items_repo) @entity = entity @items_repo = items_repo end
Public Instance Methods
favicon()
click to toggle source
# File lib/dato/local/site.rb, line 31 def favicon read_attribute(:favicon, FieldType::UploadId, false) end
global_seo()
click to toggle source
# File lib/dato/local/site.rb, line 23 def global_seo read_attribute(:global_seo, FieldType::GlobalSeo, locales.size > 1) end
theme()
click to toggle source
# File lib/dato/local/site.rb, line 27 def theme read_attribute(:theme, FieldType::Theme, false) end
to_hash()
click to toggle source
# File lib/dato/local/site.rb, line 44 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()
click to toggle source
# File lib/dato/local/site.rb, line 35 def to_s "#<Site id=#{id} site_name=#{name}>" end
Also aliased as: inspect
Private Instance Methods
read_attribute(method, type_klass, localized)
click to toggle source
# File lib/dato/local/site.rb, line 62 def read_attribute(method, type_klass, localized) value = if localized obj = entity[method] || {} Utils::LocaleValue.find(obj) else entity[method] end type_klass.parse(value, @items_repo) end