Sha256: 177c180ff26d1c6cfdc0156fc4b712cc073d6749ecc72ad30d5dac444762c326

Contents?: true

Size: 493 Bytes

Versions: 9

Compression:

Stored size: 493 Bytes

Contents

# encoding: utf-8
module Sunrise
  module Models
    module Header
      extend ActiveSupport::Concern
      
      included do
        belongs_to :headerable, :polymorphic => true
      end
      
      module ClassMethods
      end
      
      def empty?
        [keywords, description, title].map(&:blank?).all?
      end

      def has_info?
        !empty?
      end

      def read(key)
        value = read_attribute(key)
        value.blank? ? nil : value
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sunrise-cms-0.4.2 lib/sunrise/models/header.rb
sunrise-cms-0.4.1 lib/sunrise/models/header.rb
sunrise-cms-0.4.0 lib/sunrise/models/header.rb
sunrise-cms-0.3.3 lib/sunrise/models/header.rb
sunrise-cms-0.3.2 lib/sunrise/models/header.rb
sunrise-cms-0.3.1 lib/sunrise/models/header.rb
sunrise-cms-0.3.0 lib/sunrise/models/header.rb
sunrise-cms-0.3.0.rc2 lib/sunrise/models/header.rb
sunrise-cms-0.3.0.rc lib/sunrise/models/header.rb