Sha256: 1dd88697387735306f4a81d6ebc042e5d2abacf28b505f556bdac729ebfa0e3e

Contents?: true

Size: 495 Bytes

Versions: 6

Compression:

Stored size: 495 Bytes

Contents

module Lookbook
  class Component < Entity
    attr_accessor :name

    def initialize(name)
      @name = name
      super(path)
    end

    def path
      name.underscore
    end

    def full_path
      Pathname.new("#{Lookbook.config.components_path}/#{path}.rb")
    end

    def dir_path
      full_path.dirname
    end

    def template_path
      Dir.glob("#{Lookbook.config.components_path}/#{path}.*.erb").first
    end

    def inline?
      template_path.present?
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lookbook-1.0.1 lib/lookbook/component.rb
lookbook-1.0.0 lib/lookbook/component.rb
lookbook-1.0.0.rc.3 lib/lookbook/component.rb
lookbook-1.0.0.rc.2 lib/lookbook/component.rb
lookbook-1.0.0.rc.1 lib/lookbook/component.rb
lookbook-1.0.0.beta.8 lib/lookbook/component.rb