Class: Unparser::CLI::Source::Generated

Inherits:
Object
  • Object
show all
Defined in:
lib/unparser/cli/source.rb

Overview

Source state generated after first unparse

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.build(ast) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Build generated source

Parameters:

  • (Parser::AST::Node)


31
32
33
34
35
36
# File 'lib/unparser/cli/source.rb', line 31

def self.build(ast)
  source = Unparser.unparse(ast)
  new(source, ast, nil)
rescue StandardError => exception
  new(nil, ast, exception)
end

Instance Method Details

#success?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Test if source was generated successfully

Returns:

  • (Boolean)


21
22
23
# File 'lib/unparser/cli/source.rb', line 21

def success?
  !error
end