Module: Rails5XHRUpdate

Defined in:
lib/rails5_xhr_update/xhr_to_rails5.rb,
lib/rails5_xhr_update/cli.rb,
lib/rails5_xhr_update/version.rb

Overview

Provide the XHRToRails5 class.

Defined Under Namespace

Classes: Cli, XHRToRails5

Constant Summary collapse

VERSION =
'0.2.0'
AST_TRUE =

rubocop:disable Lint/BooleanSymbol)

Parser::AST::Node.new(:true)

Instance Method Summary collapse

Instance Method Details

#ast_pair(name, data) ⇒ Object



64
65
66
# File 'lib/rails5_xhr_update/xhr_to_rails5.rb', line 64

def ast_pair(name, data)
  Parser::AST::Node.new(:pair, [Parser::AST::Node.new(:sym, [name]), data])
end

#ast_to_string(ast) ⇒ Object



68
69
70
71
72
# File 'lib/rails5_xhr_update/xhr_to_rails5.rb', line 68

def ast_to_string(ast)
  string = Unparser.unparse(ast)[0..-2]
  string[string.index('(')] = ' '
  string
end