Class: Faceter::Rules::AppendNested Private

Inherits:
AbstractMapper::PairRule
  • Object
show all
Defined in:
lib/faceter/rules/append_nested.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Does the same as [Faceter::Rules::PrependNested] in case ‘nested’ transformation follows the ‘List`, not prepends it.

Instance Method Summary collapse

Instance Method Details

#optimizeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
# File 'lib/faceter/rules/append_nested.rb', line 20

def optimize
  Nodes::List.new { left.entries + (right.nested ? [right] : []) }
end

#optimize?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


15
16
17
# File 'lib/faceter/rules/append_nested.rb', line 15

def optimize?
  left.instance_of?(Nodes::List) && right.respond_to?(:nested)
end