Module: Yoga::Utils Private

Defined in:
lib/yoga/utils.rb

Overview

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

Utilities used with the Yoga module.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.flatten_into_set(tokens) ⇒ ::Set<Yoga::Token>

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.

Takes an array of tokens or set/array of tokens and turns it into a single set.

Parameters:

Returns:



17
18
19
20
21
22
23
24
# File 'lib/yoga/utils.rb', line 17

def flatten_into_set(tokens)
  case tokens
  when ::Set then tokens
  when ::Array then ::Set.new(tokens)
  else
    ::Set.new(tokens.to_a)
  end
end

Instance Method Details

#flatten_into_set(tokens) ⇒ ::Set<Yoga::Token> (private)

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.

Takes an array of tokens or set/array of tokens and turns it into a single set.

Parameters:

Returns:



17
18
19
20
21
22
23
24
# File 'lib/yoga/utils.rb', line 17

def flatten_into_set(tokens)
  case tokens
  when ::Set then tokens
  when ::Array then ::Set.new(tokens)
  else
    ::Set.new(tokens.to_a)
  end
end