class Locomotive::Steam::Site
Public Class Methods
new(attributes = {})
click to toggle source
Calls superclass method
Locomotive::Steam::Models::Entity::new
# File lib/locomotive/steam/entities/site.rb, line 7 def initialize(attributes = {}) super({ cache_enabled: false, cache_control: nil, cache_vary: nil, bypass_browser_locale: false, prefix_default_locale: false, updated_at: nil, content_version: nil, template_version: nil, domains: [], redirect_to_first_domain: false, redirect_to_https: false, url_redirections: [], private_access: false, password: nil, metafields_schema: {}, metafields: nil, sections: nil, sections_content: nil, asset_host: nil, routes: [] }.merge(attributes)) end
Public Instance Methods
default_locale()
click to toggle source
# File lib/locomotive/steam/entities/site.rb, line 36 def default_locale locales.first || :en end
handle()
click to toggle source
# File lib/locomotive/steam/entities/site.rb, line 32 def handle self[:handle] || self[:subdomain] end
last_modified_at()
click to toggle source
# File lib/locomotive/steam/entities/site.rb, line 52 def last_modified_at [self.content_version, self.template_version].compact.sort.last || self.updated_at end
locales()
click to toggle source
# File lib/locomotive/steam/entities/site.rb, line 40 def locales (self[:locales] || [:en]).map(&:to_sym) end
timezone()
click to toggle source
# File lib/locomotive/steam/entities/site.rb, line 48 def timezone @timezone ||= ActiveSupport::TimeZone.new(timezone_name) end
timezone_name()
click to toggle source
# File lib/locomotive/steam/entities/site.rb, line 44 def timezone_name self[:timezone] || self[:timezone_name] || 'UTC' end
to_liquid()
click to toggle source
# File lib/locomotive/steam/entities/site.rb, line 56 def to_liquid Locomotive::Steam::Liquid::Drops::Site.new(self) end