lib/stashify/directory.rb in stashify-1.0.1 vs lib/stashify/directory.rb in stashify-1.0.2
- old
+ new
@@ -1,19 +1,28 @@
# frozen_string_literal: true
module Stashify
class Directory
- attr_reader :name
+ attr_reader :name, :files
- def initialize(name:)
+ def initialize(name:, files: [])
@name = name
+ @files = files
end
def find(name)
if directory?(name)
directory(name)
else
file(name)
+ end
+ end
+
+ def write(file)
+ if file.is_a?(Stashify::Directory)
+ write_directory(file)
+ else
+ write_file(file)
end
end
end
end