Module: Rails5XHRUpdate

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

Overview

Provide the XHRToRails5 class.

Defined Under Namespace

Classes: Cli, XHRToRails5

Constant Summary collapse

VERSION =
'0.3.0'
AST_TRUE =

rubocop:disable Lint/BooleanSymbol)

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

Class Method Summary collapse

Class Method Details

.ast_pair(name, data) ⇒ Object



5
6
7
# File 'lib/rails5_xhr_update/util.rb', line 5

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

.ast_to_string(ast) ⇒ Object



9
10
11
12
13
# File 'lib/rails5_xhr_update/util.rb', line 9

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