Class: Y2R::AST::Ruby::Program
- Inherits:
-
Node
- Object
- OpenStruct
- Node
- Y2R::AST::Ruby::Program
show all
- Defined in:
- lib/y2r/ast/ruby.rb
Overview
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?
Instance Method Details
#priority ⇒ Object
265
266
267
|
# File 'lib/y2r/ast/ruby.rb', line 265
def priority
Priority::NONE
end
|
#single_line_width_base(context) ⇒ Object
261
262
263
|
# File 'lib/y2r/ast/ruby.rb', line 261
def single_line_width_base(context)
Float::INFINITY end
|
#to_ruby(context) ⇒ Object
247
248
249
250
251
252
253
254
255
256
257
258
259
|
# File 'lib/y2r/ast/ruby.rb', line 247
def to_ruby(context)
combine do |parts|
statements_code = context do ||
wrap_code_with_parens do |parens_context|
statements.to_ruby(parens_context.with_priority(priority))
end
end
parts << "# encoding: utf-8"
parts << ""
parts << statements_code
end
end
|