Sha256: c79f5391f1d0d296f9581089543e35de78f3baf7b0c23c1d5c50cfc89fdf2c0b

Contents?: true

Size: 570 Bytes

Versions: 8

Compression:

Stored size: 570 Bytes

Contents

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

    def empty?
      @files.empty?
    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

8 entries across 8 versions & 1 rubygems

Version Path
mireru-0.1.4 lib/mireru/container.rb
mireru-0.1.3 lib/mireru/container.rb
mireru-0.1.2 lib/mireru/container.rb
mireru-0.1.1 lib/mireru/container.rb
mireru-0.1.0 lib/mireru/container.rb
mireru-0.0.9 lib/mireru/container.rb
mireru-0.0.8 lib/mireru/container.rb
mireru-0.0.7 lib/mireru/container.rb