Class: Y2R::AST::Ruby::Class
- Inherits:
-
Node
- Object
- OpenStruct
- Node
- Y2R::AST::Ruby::Class
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
295
296
297
|
# File 'lib/y2r/ast/ruby.rb', line 295
def priority
Priority::NONE
end
|
#single_line_width_base(context) ⇒ Object
291
292
293
|
# File 'lib/y2r/ast/ruby.rb', line 291
def single_line_width_base(context)
Float::INFINITY
end
|
#to_ruby_base(context) ⇒ Object
277
278
279
280
281
282
283
284
285
286
287
288
289
|
# File 'lib/y2r/ast/ruby.rb', line 277
def to_ruby_base(context)
superclass_shift = 6 + name.size + 3
superclass_context = context.
shifted(superclass_shift).
with_priority(priority)
superclass_code = superclass.to_ruby(superclass_context)
combine do |parts|
parts << "class #{name} < #{superclass_code}"
parts << indented(statements, context.with_priority(priority))
parts << "end"
end
end
|