Class: GistDirectory
- Inherits:
-
Object
- Object
- GistDirectory
- Defined in:
- lib/gist_directory.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #create(filename: nil) ⇒ Object
-
#initialize(path: nil) ⇒ GistDirectory
constructor
A new instance of GistDirectory.
Constructor Details
#initialize(path: nil) ⇒ GistDirectory
Returns a new instance of GistDirectory.
13 14 15 |
# File 'lib/gist_directory.rb', line 13 def initialize(path: nil) @path = File.(path) end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
10 11 12 |
# File 'lib/gist_directory.rb', line 10 def path @path end |
Instance Method Details
#create(filename: nil) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gist_directory.rb', line 17 def create(filename: nil) raise "No filename supplied" if filename.nil? if path_exists? fail_unless_gist_directory fail_if_filename_exists filename add_file_to_directory filename: filename else do_gist_create filename: filename end end |