Sha256: 342e39116510b5bdf3689c4c88c6fe3a3ad3c45ee7be39df4fd6e4ae32848470

Contents?: true

Size: 809 Bytes

Versions: 12

Compression:

Stored size: 809 Bytes

Contents

module Lookbook
  class Component < Entity
    include Locatable

    attr_reader :component_class

    def initialize(component_class)
      @component_class = component_class
      @file_path = "#{Engine.component_paths.first}/#{name.underscore}.rb"
      @base_directories = Engine.component_paths
      @lookup_path = PathUtils.to_lookup_path(relative_file_path)
    end

    def name
      component_class.name
    end

    def template_file_path
      Dir.glob("#{directory_path}/#{file_name(true)}.*.erb").first
    end

    def inline?
      template_file_path.present?
    end

    def template_path
      Lookbook.logger.warn "The `template_path` method has been deprecated - use `template_file_path` instead. `template_file_path` will be removed in v2.0"
      template_file_path
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
lookbook-1.5.5 lib/lookbook/entities/component.rb
lookbook-1.5.4 lib/lookbook/entities/component.rb
lookbook-1.5.3 lib/lookbook/entities/component.rb
lookbook-1.5.2 lib/lookbook/entities/component.rb
lookbook-1.5.1 lib/lookbook/entities/component.rb
lookbook-1.5.0 lib/lookbook/entities/component.rb
lookbook-1.4.5 lib/lookbook/entities/component.rb
lookbook-1.4.4 lib/lookbook/entities/component.rb
lookbook-1.4.3 lib/lookbook/entities/component.rb
lookbook-1.4.2 lib/lookbook/entities/component.rb
lookbook-1.4.1 lib/lookbook/entities/component.rb
lookbook-1.4.0 lib/lookbook/entities/component.rb