Class: Y2R::AST::Ruby::Next

Inherits:
Node
  • Object
show all
Defined in:
lib/y2r/ast/ruby.rb

Constant Summary

Constants inherited from Node

Y2R::AST::Ruby::Node::INDENT_STEP

Instance Method Summary collapse

Methods inherited from Node

#ends_with_comment?, #ensure_separated, #has_comment?, #hates_to_stand_alone?, #pass_trailer?, #single_line_width, #starts_with_comment?, #to_ruby

Instance Method Details

#single_line_width_base(context) ⇒ Object



713
714
715
716
717
718
719
720
721
722
723
# File 'lib/y2r/ast/ruby.rb', line 713

def single_line_width_base(context)
  if !has_line_breaking_comment
    if value
      5 + value.single_line_width(context.with_priority(priority))
    else
      4
    end
  else
    Float::INFINITY
  end
end

#to_ruby_base(context) ⇒ Object



705
706
707
708
709
710
711
# File 'lib/y2r/ast/ruby.rb', line 705

def to_ruby_base(context)
  if !has_line_breaking_comment?
    to_ruby_base_single_line(context)
  else
    to_ruby_base_multi_line(context)
  end
end