Class: Trailblazer::Generator::Output
- Inherits:
-
Object
- Object
- Trailblazer::Generator::Output
- Defined in:
- lib/trailblazer/generator/output.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path:, content:) ⇒ Output
constructor
A new instance of Output.
- #save ⇒ Object
Constructor Details
#initialize(path:, content:) ⇒ Output
Returns a new instance of Output.
6 7 8 9 |
# File 'lib/trailblazer/generator/output.rb', line 6 def initialize(path:, content:) @path = path @content = content end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
4 5 6 |
# File 'lib/trailblazer/generator/output.rb', line 4 def content @content end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
4 5 6 |
# File 'lib/trailblazer/generator/output.rb', line 4 def path @path end |
Instance Method Details
#save ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/trailblazer/generator/output.rb', line 11 def save FileUtils.mkdir_p(File.dirname(path)) File.open(path, 'w') do |f| f.puts content end true end |