Class: RamlRubyClient::Writer
- Inherits:
-
Object
- Object
- RamlRubyClient::Writer
- Defined in:
- lib/raml_ruby_client/generator/writer.rb
Constant Summary collapse
- TEMP_DIR =
File.("../../../../samples", __FILE__)
Instance Attribute Summary collapse
-
#target_dir ⇒ Object
readonly
Returns the value of attribute target_dir.
Instance Method Summary collapse
- #flush ⇒ Object
-
#initialize(target_dir) ⇒ Writer
constructor
A new instance of Writer.
- #write_lib_file(path, content) ⇒ Object
- #write_root_file(name, content) ⇒ Object
- #write_test_file(path, content) ⇒ Object
Constructor Details
Instance Attribute Details
#target_dir ⇒ Object (readonly)
Returns the value of attribute target_dir.
3 4 5 |
# File 'lib/raml_ruby_client/generator/writer.rb', line 3 def target_dir @target_dir end |
Instance Method Details
#flush ⇒ Object
24 25 26 27 28 29 |
# File 'lib/raml_ruby_client/generator/writer.rb', line 24 def flush FileUtils.mkdir_p(@target_dir) FileUtils.mv Dir.glob(File.join(@temp, '*')), @target_dir FileUtils.rm_rf(@temp) end |
#write_lib_file(path, content) ⇒ Object
20 21 22 |
# File 'lib/raml_ruby_client/generator/writer.rb', line 20 def write_lib_file(path, content) write_file(File.join(@temp, 'lib', path), content) end |
#write_root_file(name, content) ⇒ Object
12 13 14 |
# File 'lib/raml_ruby_client/generator/writer.rb', line 12 def write_root_file(name, content) write_file(File.join(@temp, name), content) end |
#write_test_file(path, content) ⇒ Object
16 17 18 |
# File 'lib/raml_ruby_client/generator/writer.rb', line 16 def write_test_file(path, content) write_file(File.join(@temp, 'test', path), content) end |