Sha256: c98451683045fca24ac203dfd1319a16e52e6fa2a9e77a8a1127d834bd71038f

Contents?: true

Size: 943 Bytes

Versions: 1

Compression:

Stored size: 943 Bytes

Contents

# Class name is Lono::Files because can represent a single file or a directory.
# Also, it avoids conflicting with the stdlib File class name.
# Files is like a "FileList". Using shorter Files name.
module Lono
  class Files < Lono::CLI::Base
    include Concerns::Registration
    include Concerns::PostProcessing

    attr_reader :path
    def initialize(options={})
      super
      @path = options[:path]
      @caller = options[:caller] # original caller stack at registration time
    end

    def full_path
      "#{@blueprint.root}/#{@path}"
    end

    class << self
      def register(options={})
        path = options[:path]
        file = files.find { |f| f.path == path }
        unless file
          file = Files.new(options.merge(caller: caller))
          files << file
        end
        file.marker
      end

      delegate :empty?, :files, to: :files
      def files
        Registry.files
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lono-8.0.0.pre.rc3 lib/lono/files.rb