Class: Y2R::AST::Ruby::Array
- Inherits:
-
Node
- Object
- OpenStruct
- Node
- Y2R::AST::Ruby::Array
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?, #pass_trailer?, #single_line_width, #starts_with_comment?, #to_ruby
Instance Method Details
#hates_to_stand_alone? ⇒ Boolean
1537
1538
1539
|
# File 'lib/y2r/ast/ruby.rb', line 1537
def hates_to_stand_alone?
elements.empty?
end
|
#priority ⇒ Object
1533
1534
1535
|
# File 'lib/y2r/ast/ruby.rb', line 1533
def priority
Priority::ATOMIC
end
|
#single_line_width_base(context) ⇒ Object
1523
1524
1525
1526
1527
1528
1529
1530
1531
|
# File 'lib/y2r/ast/ruby.rb', line 1523
def single_line_width_base(context)
if !
elements_context = context.with_priority(Priority::NONE)
1 + list_single_line_width(elements, 2, elements_context) + 1
else
Float::INFINITY
end
end
|
#to_ruby_base(context) ⇒ Object
1515
1516
1517
1518
1519
1520
1521
|
# File 'lib/y2r/ast/ruby.rb', line 1515
def to_ruby_base(context)
if (fits_current_line?(context) && !) || elements.empty?
to_ruby_base_single_line(context)
else
to_ruby_base_multi_line(context)
end
end
|