Class: Hexp::Node::Normalize

Inherits:
Object
  • Object
show all
Defined in:
lib/hexp/node/normalize.rb

Overview

Normalize a node

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Normalize

Set a node to be normalized

Examples:

Hexp::Node::Normalize.new([:p, {class:'foo'}])

Parameters:

  • node (Array)

    A non-strict hexp



14
15
16
# File 'lib/hexp/node/normalize.rb', line 14

def initialize(args)
  @raw = args
end

Instance Method Details

#callArray

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.

Normalize to strict hexp nodes, cfr SPEC.md for details

Returns:

  • (Array)

    strict hexp node



23
24
25
# File 'lib/hexp/node/normalize.rb', line 23

def call
  [@raw.first, normalized_attributes, normalized_children]
end