Class: LearnWriter
- Inherits:
-
Object
- Object
- LearnWriter
- Defined in:
- lib/learn_writer.rb,
lib/learn_writer/version.rb
Constant Summary collapse
- VALID_CONTRIBUTING =
File.open(File.(File.dirname(__FILE__)) + '/learn_writer/valid_contributing.md')
- VALID_LICENSE =
File.open(File.(File.dirname(__FILE__)) + '/learn_writer/valid_license.md')
- VERSION =
"0.0.1"
Instance Attribute Summary collapse
-
#filepath ⇒ Object
Returns the value of attribute filepath.
Instance Method Summary collapse
-
#initialize(filepath) ⇒ LearnWriter
constructor
A new instance of LearnWriter.
- #write_contributing ⇒ Object
- #write_dot_learn ⇒ Object
- #write_license ⇒ Object
- #write_metadata ⇒ Object
Constructor Details
#initialize(filepath) ⇒ LearnWriter
Returns a new instance of LearnWriter.
10 11 12 |
# File 'lib/learn_writer.rb', line 10 def initialize(filepath) @filepath = filepath end |
Instance Attribute Details
#filepath ⇒ Object
Returns the value of attribute filepath.
8 9 10 |
# File 'lib/learn_writer.rb', line 8 def filepath @filepath end |
Instance Method Details
#write_contributing ⇒ Object
25 26 27 28 29 30 |
# File 'lib/learn_writer.rb', line 25 def write_contributing contributing = "#{filepath}/CONTRIBUTING.md" contributing_content = File.read(VALID_CONTRIBUTING) file = FileUtils.touch(contributing)[0] File.open(file, 'w') { |file| file.write(contributing_content) } end |
#write_dot_learn ⇒ Object
20 21 22 23 |
# File 'lib/learn_writer.rb', line 20 def write_dot_learn dot_learn = "#{filepath}/.learn" FileUtils.touch(dot_learn) end |
#write_license ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/learn_writer.rb', line 32 def write_license license = "#{filepath}/LICENSE.md" license_content = File.read(VALID_LICENSE) file = FileUtils.touch(license)[0] File.open(file, 'w') { |file| file.write(license_content) } end |
#write_metadata ⇒ Object
14 15 16 17 18 |
# File 'lib/learn_writer.rb', line 14 def write_dot_learn write_contributing write_license end |