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.3.4 lib/lookbook/page_section.rb
lookbook-1.3.3 lib/lookbook/page_section.rb
lookbook-1.3.1 lib/lookbook/page_section.rb
lookbook-1.3.0 lib/lookbook/page_section.rb
lookbook-1.2.1 lib/lookbook/page_section.rb
lookbook-1.2.0 lib/lookbook/page_section.rb
lookbook-1.1.1 lib/lookbook/page_section.rb
lookbook-1.1.0 lib/lookbook/page_section.rb
lookbook-1.0.8 lib/lookbook/page_section.rb
lookbook-1.0.7 lib/lookbook/page_section.rb
lookbook-1.0.6 lib/lookbook/page_section.rb
lookbook-1.0.5 lib/lookbook/page_section.rb
lookbook-1.0.4 lib/lookbook/page_section.rb
lookbook-1.0.3 lib/lookbook/page_section.rb
lookbook-1.0.2 lib/lookbook/page_section.rb
lookbook-1.0.1 lib/lookbook/page_section.rb
lookbook-1.0.0 lib/lookbook/page_section.rb
lookbook-1.0.0.rc.3 lib/lookbook/page_section.rb
lookbook-1.0.0.rc.2 lib/lookbook/page_section.rb
lookbook-1.0.0.rc.1 lib/lookbook/page_section.rb