lib/opal/nodes/x_string.rb
# Will remove empty :str lines coming from cosmetic newlines in x-strings
#
# @example
#   # this will generate two additional empty
#   # children before and after `foo()`
#   %x{
#     foo()
#   }
Will remove empty :str lines coming from cosmetic newlines in x-strings
Will remove empty : str lines coming from cosmetic newlines in x - strings
def strip_empty_children(children)
        children = children.dup
        empty_line = ->(child) { child.nil? || (child.type == :str && child.loc.expression.source.rstrip.empty?) }
        children.shift while children.any? && empty_line[children.first]
        children.pop while children.any? && empty_line[children.last]
        children
      end
def strip_empty_children ( children ) children = children . dup empty_line = -> ( child ) { child . nil? || ( child . type == :str && child . loc . expression . source . rstrip . empty? ) } children . shift while children . any? && empty_line [ children . first ] children . pop while children . any? && empty_line [ children . last ] children end
Will remove empty :str lines coming from cosmetic newlines in x-strings
Will remove empty : str lines coming from cosmetic newlines in x - strings
children
<not_specific>
example
this will generate two additional empty # children before and after `foo()` %x{ foo() }
this will generate two additional empty # children before and after ` foo () ` %x { foo () }