Method: Xi::Pattern::Transforms#**

Defined in:
lib/xi/pattern/transforms.rb

#**(numeric) ⇒ Pattern Also known as: ^

Raises each value to the power of numeric, which may be negative or fractional.

Values from pattern that do not respond to #** are ignored.

Examples:

peek (0..5).p ** 2        #=> [0, 1, 4, 9, 16, 25]
peek [1, 2, 3].p ** -2    #=> [1, (1/4), (1/9)]

Parameters:

  • numeric (Numeric)

Returns:



122
123
124
# File 'lib/xi/pattern/transforms.rb', line 122

def **(numeric)
  map { |v| v.respond_to?(:**) ? v ** numeric : v }
end