Class: Y2R::AST::Ruby::Return

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

Constant Summary

Constants inherited from Node

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



761
762
763
764
765
766
767
768
769
770
771
# File 'lib/y2r/ast/ruby.rb', line 761

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

#to_ruby_base(context) ⇒ Object



753
754
755
756
757
758
759
# File 'lib/y2r/ast/ruby.rb', line 753

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