Sha256: 36dd58066d533180543f3a96f8454e3acb2c27be54bebfc8a91f8dff2aec2c95

Contents?: true

Size: 611 Bytes

Versions: 1

Compression:

Stored size: 611 Bytes

Contents

module Mireru2
  class Container
    def initialize(files=[])
      @files = files.select {|file| file?(file) }
    end

    def empty?
      @files.empty?
    end

    def size
      @files.size
    end

    def pop(complement_file=nil)
      @files.unshift(complement_file) if complement_file
      @files.pop
    end

    def shift(complement_file=nil)
      @files.push(complement_file) if complement_file
      @files.shift
    end

    private
    def file?(file)
      unless file
        return false
      end

      unless File.file?(file)
        return false
      end

      true
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mireru2-0.0.1 lib/mireru2/container.rb