class Lookbook::Entity

@api public
Base entity class

def <=>(other)

def <=>(other)
  label <=> other.label
end

def fetch_config(key, fallback = nil, &block)

def fetch_config(key, fallback = nil, &block)
  Utils.value_or_fallback(nil, fallback, &block)
end

def id

Returns:
  • (String) - The ID
def id
  Utils.id(fetch_config(:id) { lookup_path.tr("/", "-") })
end

def initialize(lookup_path = nil)

Other tags:
    Api: - private
def initialize(lookup_path = nil)
  @lookup_path = lookup_path
end

def label

Returns:
  • (String) - The label
def label
  @_label ||= fetch_config(:label) { name.titleize }
end

def lookup_path

Returns:
  • (String) - The lookup path
def lookup_path
  return @_lookup_path if @_lookup_path
  directory = fetch_config(:logical_path) do
    dir = File.dirname(@lookup_path)
    dir if !dir.start_with?(".")
  end
  @_lookup_path ||= PathUtils.strip_slashes(PathUtils.to_path(directory, name))
end

def name

Returns:
  • (String) - The name
def name
  @_name ||= Utils.name(File.basename(@lookup_path))
end

def type

Returns:
  • (Symbol) - The entity type
def type
  @_type ||= self.class.name.gsub("Entity", "").demodulize.underscore.downcase.to_sym
end