Class: Expressir::Commands::Clean
- Defined in:
- lib/expressir/commands/clean.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#exit_with_error, #initialize, #say
Constructor Details
This class inherits a constructor from Expressir::Commands::Base
Instance Method Details
#run(path) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/expressir/commands/clean.rb', line 4 def run(path) repository = Expressir::Express::Parser.from_file(path) formatted_schemas = repository.schemas.map do |schema| # Format schema without remarks schema.to_s(no_remarks: true) end.join("\n\n") if [:output] File.write([:output], formatted_schemas) say "Cleaned schema written to #{[:output]}" else say formatted_schemas end end |