Sha256: df20b45051b9b585df35168d58088026a765e4e1d1d3512583ca2da106d0bf38

Contents?: true

Size: 636 Bytes

Versions: 8

Compression:

Stored size: 636 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

8 entries across 8 versions & 1 rubygems

Version Path
lookbook-1.0.0.beta.7 lib/lookbook/entity.rb
lookbook-1.0.0.beta.6 lib/lookbook/entity.rb
lookbook-1.0.0.beta.5 lib/lookbook/entity.rb
lookbook-1.0.0.beta.4 lib/lookbook/entity.rb
lookbook-1.0.0.beta.3 lib/lookbook/entity.rb
lookbook-1.0.0.beta.2 lib/lookbook/entity.rb
lookbook-1.0.0.beta.1 lib/lookbook/entity.rb
lookbook-1.0.0.beta.0 lib/lookbook/entity.rb