Sha256: ad54d68697e1381ea05bbc8b5e181118a42d86dd6675701c30bfa0209a4511c7

Contents?: true

Size: 637 Bytes

Versions: 21

Compression:

Stored size: 637 Bytes

Contents

module Lookbook
  class Entity
    include Utils

    def initialize(reference_path)
      @refpath = reference_path
    end

    def id
      generate_id(lookup_path)
    end

    def label
      lookup_path.split("/").last.titleize
    end

    def type
      :item
    end

    def path
      @refpath
    end

    def lookup_path
      @lookup_path ||= to_lookup_path(@refpath)
    end

    def hierarchy_depth
      @refpath.present? ? @refpath.split("/").size : 0
    end

    def position
      0
    end

    def hidden?
      false
    end

    def matchers
      nil
    end

    alias_method :url_path, :lookup_path
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

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