Sha256: c4805320a8a5bc87c5b786b79f1f680dcc2944fc3ac7f13f904b99e74e662021

Contents?: true

Size: 667 Bytes

Versions: 7

Compression:

Stored size: 667 Bytes

Contents

module Locomotive::Steam

  class Site

    include Locomotive::Steam::Models::Entity

    def initialize(attributes = {})
      super({
        prefix_default_locale: false
      }.merge(attributes))
    end

    def handle
      self[:handle] || self[:subdomain]
    end

    def default_locale
      locales.try(:first) || :en
    end

    def locales
      self[:locales].map(&:to_sym)
    end

    def timezone_name
      self[:timezone] || self[:timezone_name] || 'UTC'
    end

    def timezone
      @timezone ||= ActiveSupport::TimeZone.new(timezone_name)
    end

    def to_liquid
      Locomotive::Steam::Liquid::Drops::Site.new(self)
    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
locomotivecms_steam-1.0.0.pre.beta.3 lib/locomotive/steam/entities/site.rb
locomotivecms_steam-1.0.0.pre.beta.2 lib/locomotive/steam/entities/site.rb
locomotivecms_steam-1.0.0.pre.beta.1 lib/locomotive/steam/entities/site.rb
locomotivecms_steam-1.0.0.pre.alpha.3 lib/locomotive/steam/entities/site.rb
locomotivecms_steam-1.0.0.pre.alpha.2 lib/locomotive/steam/entities/site.rb
locomotivecms_steam-1.0.0.pre.alpha.1 lib/locomotive/steam/entities/site.rb
locomotivecms_steam-1.0.0.pre.alpha lib/locomotive/steam/entities/site.rb