Skip to content

Instantly share code, notes, and snippets.

@jeremyrajan
Created July 22, 2016 08:53
Show Gist options
  • Save jeremyrajan/8c12c4039254777cdca5bfc926915fd2 to your computer and use it in GitHub Desktop.
Save jeremyrajan/8c12c4039254777cdca5bfc926915fd2 to your computer and use it in GitHub Desktop.
candy
=begin
@module FileSystem
Structure: data = [{
type: 'd',
name: 'c',
path: '/c',
children: [{
type: 'f',
name: 'myfolder',
path: '/c/myfolder',
children: [{
type: 't',
name: 'textfile',
path: '/c/myfolder/textfile',
content: 'My Content'
}]
}]
}]
=end
# initialize a empty array to whole information
@data = []
# Entity will create individual entities, whether be Drive, Folder, file, zip etc
# Only Drive, folder and zip can have childerns
class Entity
attr_accessor :type, :name, :path, :children
# initialize the entity
def initialize(type, name, path)
end
# delete the entity when path is provided
def delete(path)
end
# Move the entity source => destination
def move(source_path, destination_path)
end
# Write content to a file
def write_to_file(path, content)
end
private
def find_parent
end
# return the object which can be later used to
def get_file(path)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment