Class: Y2R::AST::Ruby::Hash
- Inherits:
-
Node
- Object
- OpenStruct
- Node
- Y2R::AST::Ruby::Hash
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
1587
1588
1589
|
# File 'lib/y2r/ast/ruby.rb', line 1587
def hates_to_stand_alone?
entries.empty?
end
|
#priority ⇒ Object
1583
1584
1585
|
# File 'lib/y2r/ast/ruby.rb', line 1583
def priority
Priority::ATOMIC
end
|
#single_line_width_base(context) ⇒ Object
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
|
# File 'lib/y2r/ast/ruby.rb', line 1569
def single_line_width_base(context)
if !entries.empty?
if !
entries_context = context.with_priority(Priority::NONE)
2 + list_single_line_width(entries, 2, entries_context) + 2
else
Float::INFINITY
end
else
2
end
end
|
#to_ruby_base(context) ⇒ Object
1561
1562
1563
1564
1565
1566
1567
|
# File 'lib/y2r/ast/ruby.rb', line 1561
def to_ruby_base(context)
if (fits_current_line?(context) && !) || entries.empty?
to_ruby_base_single_line(context)
else
to_ruby_base_multi_line(context)
end
end
|