Class: RbsInlineData::Writer
- Inherits:
-
Object
- Object
- RbsInlineData::Writer
- Defined in:
- lib/rbs_inline_data/writer.rb
Class Method Summary collapse
-
.write(definitions, output_path) ⇒ Object
-
(Array, Pathname?) -> void.
Instance Method Summary collapse
-
#initialize(definitions) ⇒ Writer
constructor
-
(Array) -> void.
-
#write(output_path) ⇒ Object
-
(Pathname?) -> void.
Constructor Details
Class Method Details
.write(definitions, output_path) ⇒ Object
-
(Array, Pathname?) -> void
6 7 8 |
# File 'lib/rbs_inline_data/writer.rb', line 6 def self.write(definitions, output_path) new(definitions).write(output_path) end |
Instance Method Details
#write(output_path) ⇒ Object
-
(Pathname?) -> void
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rbs_inline_data/writer.rb', line 18 def write(output_path) return if @definitions.empty? if output_path output_path.parent.mkpath unless output_path.parent.directory? output_path.write(build_rbs(@definitions)) else puts build_rbs(@definitions) end end |