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 generateg source

Parameters:

  • (Parser::AST::Node)


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

def self.build(ast)
  source = Unparser.unparse(ast)
  new(source, ast, nil)
rescue => 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)


19
20
21
# File 'lib/unparser/cli/source.rb', line 19

def success?
  !error
end