Sha256: 1434ab1d2111519683369203edaeb5a61758cb1420ed5cba7238eb270de6b186

Contents?: true

Size: 535 Bytes

Versions: 3

Compression:

Stored size: 535 Bytes

Contents

# frozen_string_literal: true

require "stashify"

module Stashify
  class File
    attr_reader :name, :path, :contents

    def initialize(name: nil, path: nil, contents: "")
      raise StandardError, "name or path must be defined" unless name || path
      raise Stashify::InvalidFile, "Name '#{name}' contains a /" if name && name =~ %r{/}

      @path = path
      @name = name || ::File.basename(path)
      @contents = contents
    end

    def ==(other)
      name == other.name && contents == other.contents
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stashify-2.1.1 lib/stashify/file.rb
stashify-2.1.0 lib/stashify/file.rb
stashify-2.0.0 lib/stashify/file.rb