Sha256: 3f5cc2cef0b2026505df4176a539d353c34efeec0b506bfc6e3f6e17ddfd3c21

Contents?: true

Size: 762 Bytes

Versions: 7

Compression:

Stored size: 762 Bytes

Contents

# encoding: UTF-8


module Spontaneous
  class Piece < Content
    include Plugins::Supertype

    # Public: for Pieces #parent is the same as the #owner
    # whereas for pages, parent is the next page up in the
    # page hierarchy.
    #
    # Returns: Content node one up in the page hierarchy
    alias_method :parent,     :owner

    set_inheritance_root

    def export(user = nil)
      super(user).merge(export_styles)
    end


    def export_styles
      h = { :style => style_sid.to_s }
      if container
        h.merge!({
          :styles => container.available_styles(self).map { |s| s.schema_id.to_s }
        })
      else
        h.merge!({
          :styles => self.styles.map { |s| s.schema_id.to_s }
        })
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
spontaneous-0.2.0.alpha7 lib/spontaneous/piece.rb
spontaneous-0.2.0.alpha6 lib/spontaneous/piece.rb
spontaneous-0.2.0.alpha5 lib/spontaneous/piece.rb
spontaneous-0.2.0.alpha4 lib/spontaneous/piece.rb
spontaneous-0.2.0.alpha3 lib/spontaneous/piece.rb
spontaneous-0.2.0.alpha2 lib/spontaneous/piece.rb
spontaneous-0.2.0.alpha1 lib/spontaneous/piece.rb