Sha256: a73956e96c9575aef159a1f247407dcbbc0cb9873bfd77637dfd4cd7c0ddf037

Contents?: true

Size: 434 Bytes

Versions: 21

Compression:

Stored size: 434 Bytes

Contents

module Lookbook
  class PageSection < Page
    def name
      return @name if @name.present?
      matches = full_path.to_s.match(%r{\[(?<name>\w+)\]})
      @name ||= matches[:name]
    end

    def id
      "#{super}-#{name}"
    end

    def url_path
      nil
    end

    def path
      super.gsub("[#{name}]", "")
    end

    def type
      :page_section
    end

    def lookup_path
      "#{super}/#{name}"
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
lookbook-1.0.0.beta.8 lib/lookbook/page_section.rb