Sha256: 85db662bfaa00eb0de6b7225fede7268ade8606d61b45bc9fd1e5f918c58abbd

Contents?: true

Size: 583 Bytes

Versions: 4

Compression:

Stored size: 583 Bytes

Contents

module Lono
  class Component
    attr_reader :name
    def initialize(options={})
      @options = options
      @name = options[:name]
    end

    def type
      self.class.name.to_s.split('::').last.underscore # IE: blueprint
    end

    def exist?
      !root.nil?
    end

    def type_dir
      type.pluralize # IE: blueprints
    end

    def root
      paths = Dir.glob("#{Lono.root}/{app,vendor}/#{type_dir}/*")
      paths.find do |path|
        found = path.sub(%r{.*/(app|vendor)/}, '')
        found == "#{type_dir}/#{@name}" # exact match
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lono-8.0.0.pre.rc6 lib/lono/component.rb
lono-8.0.0.pre.rc5 lib/lono/component.rb
lono-8.0.0.pre.rc4 lib/lono/component.rb
lono-8.0.0.pre.rc3 lib/lono/component.rb