Class: Y2R::AST::Ruby::If
- Inherits:
-
Node
- Object
- OpenStruct
- Node
- Y2R::AST::Ruby::If
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
#priority ⇒ Object
447
448
449
|
# File 'lib/y2r/ast/ruby.rb', line 447
def priority
Priority::NONE
end
|
#single_line_width_base(context) ⇒ Object
434
435
436
437
438
439
440
441
442
443
444
445
|
# File 'lib/y2r/ast/ruby.rb', line 434
def single_line_width_base(context)
if !self.else && !
inner_context = context.with_priority(priority)
then_width = self.then.single_line_width(inner_context)
condition_width = condition.single_line_width(inner_context)
then_width + 4 + condition_width
else
Float::INFINITY
end
end
|
#to_ruby_base(context) ⇒ Object
425
426
427
428
429
430
431
432
|
# File 'lib/y2r/ast/ruby.rb', line 425
def to_ruby_base(context)
if fits_current_line?(context) && !self.elsif &&
!
to_ruby_base_single_line(context)
else
to_ruby_base_multi_line(context)
end
end
|