Sha256: 18b553ca2e878bdf4a3c9fc7ba1ff2cdbbded3c907e46a0b6a5dfa10c747fd57

Contents?: true

Size: 554 Bytes

Versions: 15

Compression:

Stored size: 554 Bytes

Contents

module Lookbook
  class Component < Entity
    attr_accessor :name

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

    def path
      name.underscore
    end

    def rel_path
      Pathname.new("#{path}.rb")
    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

15 entries across 15 versions & 1 rubygems

Version Path
lookbook-1.3.4 lib/lookbook/component.rb
lookbook-1.3.3 lib/lookbook/component.rb
lookbook-1.3.1 lib/lookbook/component.rb
lookbook-1.3.0 lib/lookbook/component.rb
lookbook-1.2.1 lib/lookbook/component.rb
lookbook-1.2.0 lib/lookbook/component.rb
lookbook-1.1.1 lib/lookbook/component.rb
lookbook-1.1.0 lib/lookbook/component.rb
lookbook-1.0.8 lib/lookbook/component.rb
lookbook-1.0.7 lib/lookbook/component.rb
lookbook-1.0.6 lib/lookbook/component.rb
lookbook-1.0.5 lib/lookbook/component.rb
lookbook-1.0.4 lib/lookbook/component.rb
lookbook-1.0.3 lib/lookbook/component.rb
lookbook-1.0.2 lib/lookbook/component.rb